diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-17 22:37:09 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-17 22:37:09 +0200 |
commit | 154df68cb2a74a3b22456e8ec5af3af54352a41f (patch) | |
tree | f9d2c83b30322d81691ae1a013813add6ec6b99e /robot/hypervisor.c | |
parent | 2b75425070662b869c15673623df44e30ce43ebe (diff) |
fix buffer overflow in error handling module
- fixed ring buffer overflow in errcatch module
- fixed naming of commands in sercomm module
- added comments to macro's in consts.h
- properly handle `W2_E_WARN_UNCAUGHT_ERROR` and
`W2_E_WARN_ERR_BUFFER_FULL` (these used to cause infinite loops)
- added buffer full warning code
- added options to hide some simulation messages
- more boilerplate sercomm module code
Diffstat (limited to 'robot/hypervisor.c')
-rw-r--r-- | robot/hypervisor.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/robot/hypervisor.c b/robot/hypervisor.c index dbdc62a..c558de8 100644 --- a/robot/hypervisor.c +++ b/robot/hypervisor.c @@ -1,5 +1,4 @@ #include "hypervisor.h" -#include "consts.h" #include "errcatch.h" #include "io.h" #include "modes.h" @@ -7,6 +6,10 @@ #include "sercomm.h" void w2_hypervisor_main() { +#ifdef W2_SIM + siminfo("cycle start\n"); +#endif + time_reset(); w2_sercomm_main(); @@ -18,14 +21,10 @@ void w2_hypervisor_main() { w2_modes_main(); unsigned long mode_time = get_ms() - io_time; -#ifdef W2_SIM - siminfo("sercomm: %lums\n", sercomm_time); - siminfo("errcatch: %lums\n", errcatch_time); - siminfo("io: %lums\n", io_time); - siminfo("mode: %lums\n", mode_time); + if (mode_time > W2_MAX_MODULE_CYCLE_MS) w2_errcatch_throw(W2_E_WARN_CYCLE_EXPIRED); +#ifdef W2_SIM + siminfo("cycle end\n"); usleep(100e3); #endif - - if (mode_time > W2_MAX_MODULE_CYCLE_MS) w2_errcatch_throw(W2_E_WARN_CYCLE_EXPIRED); } |