aboutsummaryrefslogtreecommitdiff
path: root/robot/errcatch.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-17 19:26:21 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-17 20:33:34 +0200
commitf00fca5f6f9751b16d868f52bda908c7b4704457 (patch)
treefd806de2831cbbda07eb84bf74399f7b2b4db112 /robot/errcatch.c
parent2811447fb6c42b72c04abfc557edf270d4936a97 (diff)
changed error code names following @FlamingHotToast's suggestion
Diffstat (limited to 'robot/errcatch.c')
-rw-r--r--robot/errcatch.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/robot/errcatch.c b/robot/errcatch.c
index 0dc60e9..0f97566 100644
--- a/robot/errcatch.c
+++ b/robot/errcatch.c
@@ -8,15 +8,15 @@
#include "modes.h"
#include "orangutan_shim.h"
-w2_s_error *g_w2_error_buffer[W2_ERROR_BUFFER_SIZE] = {};
-uint8_t g_w2_error_index = 0;
-uint8_t g_w2_error_offset = 0;
+w2_s_error *g_w2_error_buffer[W2_E_BUFFER_SIZE] = {};
+uint8_t g_w2_error_index = 0;
+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_errcatch_handle_error(error);
- g_w2_error_offset = (g_w2_error_offset + 1) % W2_ERROR_BUFFER_SIZE;
+ g_w2_error_offset = (g_w2_error_offset + 1) % W2_E_BUFFER_SIZE;
}
}
@@ -33,22 +33,22 @@ void w2_errcatch_throw_msg(enum w2_e_errorcodes code, uint16_t length, const cha
free(g_w2_error_buffer[g_w2_error_index]);
w2_s_error *error = w2_alloc_error(code, length, message);
g_w2_error_buffer[g_w2_error_index] = error;
- g_w2_error_index = (g_w2_error_index + 1) % W2_ERROR_BUFFER_SIZE;
+ g_w2_error_index = (g_w2_error_index + 1) % W2_E_BUFFER_SIZE;
}
void w2_errcatch_handle_error(w2_s_error *error) {
- uint8_t severity = error->code & W2_ERR_TYPE_MASK;
+ uint8_t severity = error->code & W2_E_TYPE_MASK;
// trigger emergency mode for critical errors
- if ((severity ^ W2_ERR_TYPE_CRIT) == 0) g_w2_current_mode = &w2_mode_halt;
+ if ((severity ^ W2_E_TYPE_CRIT) == 0) g_w2_current_mode = &w2_mode_halt;
// TODO: handle more error types
switch (error->code) {
- case W2_ERR_UNCAUGHT_ERROR: {
+ case W2_E_WARN_UNCAUGHT_ERROR: {
break;
}
default: {
- w2_errcatch_throw(W2_ERR_UNCAUGHT_ERROR);
+ w2_errcatch_throw(W2_E_WARN_UNCAUGHT_ERROR);
#ifdef W2_SIM
simwarn("Uncaught/unhandled error found with code 0x%02x\n", error->code);
#endif