From 837acf351ae96e2392efde175a61fd33e0774961 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 18 May 2022 09:02:55 +0200 Subject: added comments to error code enum --- robot/errcatch.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/robot/errcatch.h b/robot/errcatch.h index 9f737d8..c6edcfb 100644 --- a/robot/errcatch.h +++ b/robot/errcatch.h @@ -18,18 +18,27 @@ * reserved for error type checking */ enum w2_e_errorcodes { - // critical error codes - W2_E_CRIT_CONN_LOST = 0x00 | W2_E_TYPE_CRIT, - W2_E_CRIT_COM_UNAVAILABLE = 0x01 | W2_E_TYPE_CRIT, // client-only - W2_E_CRIT_LINE_LOST = 0x02 | W2_E_TYPE_CRIT, - W2_E_CRIT_OBSTACLE_STUCK = 0x03 | W2_E_TYPE_CRIT, + /** wireless connection lost from either robot or client-side */ + W2_E_CRIT_CONN_LOST = 0x00 | W2_E_TYPE_CRIT, + /** serial COM-port unavalable. client-side only */ + W2_E_CRIT_COM_UNAVAILABLE = 0x01 | W2_E_TYPE_CRIT, + /** line unable to be found automatically */ + W2_E_CRIT_LINE_LOST = 0x02 | W2_E_TYPE_CRIT, + /** obstacle unavoidable, robot stuck */ + W2_E_CRIT_OBSTACLE_STUCK = 0x03 | W2_E_TYPE_CRIT, - // warnings - W2_E_WARN_BATTERY_LOW = 0x00 | W2_E_TYPE_WARN, + /** battery low, returning to charging station */ + W2_E_WARN_BATTERY_LOW = 0x00 | W2_E_TYPE_WARN, + /** obstacle detected, waiting then trying other route */ W2_E_WARN_OBSTACLE_DETECTED = 0x01 | W2_E_TYPE_WARN, - W2_E_WARN_CYCLE_EXPIRED = 0x02 | W2_E_TYPE_WARN, - W2_E_WARN_UNCAUGHT_ERROR = 0x03 | W2_E_TYPE_WARN, - W2_E_WARN_ERR_BUFFER_FULL = 0x04 | W2_E_TYPE_WARN, + /** logic cycle took longer than `W2_MAX_MODULE_CYCLE_MS` */ + W2_E_WARN_CYCLE_EXPIRED = 0x02 | W2_E_TYPE_WARN, + /** error thrown without handler, gets thrown on next cycle */ + W2_E_WARN_UNCAUGHT_ERROR = 0x03 | W2_E_TYPE_WARN, + /** error buffer full, gets thrown on next cycle */ + W2_E_WARN_ERR_BUFFER_FULL = 0x04 | W2_E_TYPE_WARN, + /** line lost, trying to calibrate */ + W2_E_WARN_LINE_LOST = 0x05 | W2_E_TYPE_WARN, }; /** -- cgit v1.2.3