diff options
-rw-r--r-- | robot/consts.h | 2 | ||||
-rw-r--r-- | robot/errcatch.c | 8 | ||||
-rw-r--r-- | robot/errcatch.h | 2 | ||||
-rw-r--r-- | robot/hypervisor.c | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/robot/consts.h b/robot/consts.h index c7bbc3f..a81908d 100644 --- a/robot/consts.h +++ b/robot/consts.h @@ -32,5 +32,5 @@ enum w2_e_errorcodes { W2_ERR_BATTERY_LOW = 0x00 | W2_ERR_TYPE_WARN, W2_ERR_OBSTACLE_DETECTED = 0x01 | W2_ERR_TYPE_WARN, W2_ERR_CYCLE_EXPIRED = 0x02 | W2_ERR_TYPE_WARN, - W2_ERR_UNCAUGHT_ERROR = 0x03 | W2_ERR_TYPE_WARN, + W2_ERR_UNCAUGHT_ERROR = 0x03 | W2_ERR_TYPE_WARN, }; diff --git a/robot/errcatch.c b/robot/errcatch.c index 945aa96..d5ad320 100644 --- a/robot/errcatch.c +++ b/robot/errcatch.c @@ -14,7 +14,7 @@ uint8_t g_w2_error_offset = 0; void w2_errcatch_main() { while (g_w2_error_index != g_w2_error_offset) { - w2_s_error* error = &g_w2_error_buffer[g_w2_error_offset]; + w2_s_error *error = &g_w2_error_buffer[g_w2_error_offset]; w2_errcatch_handle_error(error); free(error); g_w2_error_offset = (g_w2_error_offset + 1) % W2_ERROR_BUFFER_SIZE; @@ -36,7 +36,7 @@ void w2_errcatch_throw_msg(enum w2_e_errorcodes code, uint16_t length, const cha g_w2_error_index = (g_w2_error_index + 1) % W2_ERROR_BUFFER_SIZE; } -void w2_errcatch_handle_error(w2_s_error* error) { +void w2_errcatch_handle_error(w2_s_error *error) { uint8_t severity = error->code & W2_ERR_TYPE_MASK; // trigger emergency mode for critical errors @@ -49,9 +49,9 @@ void w2_errcatch_handle_error(w2_s_error* error) { } default: { w2_errcatch_throw(W2_ERR_UNCAUGHT_ERROR); - #ifdef W2_SIM +#ifdef W2_SIM simwarn("Uncaught/unhandled error found with code 0x%02x", error->code); - #endif +#endif } } diff --git a/robot/errcatch.h b/robot/errcatch.h index 5afe5b3..2297886 100644 --- a/robot/errcatch.h +++ b/robot/errcatch.h @@ -27,7 +27,7 @@ extern uint8_t g_w2_error_offset; void w2_errcatch_main(); /** handle error */ -void w2_errcatch_handle_error(w2_s_error* error); +void w2_errcatch_handle_error(w2_s_error *error); /** append error to error buffer */ void w2_errcatch_throw(enum w2_e_errorcodes code); diff --git a/robot/hypervisor.c b/robot/hypervisor.c index 2e263ce..6b32776 100644 --- a/robot/hypervisor.c +++ b/robot/hypervisor.c @@ -1,6 +1,6 @@ +#include "hypervisor.h" #include "consts.h" #include "errcatch.h" -#include "hypervisor.h" #include "io.h" #include "modes.h" #include "orangutan_shim.h" @@ -18,14 +18,14 @@ void w2_hypervisor_main() { w2_modes_main(); unsigned long mode_time = get_ms() - io_time; - #ifdef W2_SIM +#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); usleep(100e3); - #endif +#endif if (mode_time > W2_MAX_MODULE_CYCLE_MS) w2_errcatch_throw(W2_ERR_CYCLE_EXPIRED); } |