mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-19 00:02:08 +08:00
4d6c98aa6b
* this should work but doesnt * Only offroad * works * make it work offorad * reduce diff * cleanup * need util Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: a94ba4fb8b704a5462352af4501290f63c987754
18 lines
458 B
C++
18 lines
458 B
C++
#include <string>
|
|
#include <cstdint>
|
|
#include <unistd.h>
|
|
|
|
#include "common/timing.h"
|
|
#include "common/util.h"
|
|
#include "common/watchdog.h"
|
|
|
|
const std::string watchdog_fn_prefix = "/dev/shm/wd_"; // + <pid>
|
|
|
|
bool watchdog_kick(){
|
|
std::string fn = watchdog_fn_prefix + std::to_string(getpid());
|
|
std::string cur_t = std::to_string(nanos_since_boot());
|
|
|
|
int r = write_file(fn.c_str(), cur_t.data(), cur_t.length(), O_WRONLY | O_CREAT);
|
|
return r == 0;
|
|
}
|