diff --git a/python/fusion_engine_client/analysis/analyzer.py b/python/fusion_engine_client/analysis/analyzer.py index 545993c8..3d24e94a 100755 --- a/python/fusion_engine_client/analysis/analyzer.py +++ b/python/fusion_engine_client/analysis/analyzer.py @@ -2095,7 +2095,8 @@ def plot_events(self): description_str.replace('<', '[').replace('>', ']').replace('\n', '
'), ]) - if isinstance(message, EventNotificationMessage) and message.event_type == EventType.RESET: + if (isinstance(message, EventNotificationMessage) and + message.event_type in (EventType.RESET_REQUESTED, EventType.RESET_COMPLETE)): if system_time_ns in times_before_resets: rows[-1][2] = f'{(times_before_resets[system_time_ns]):.3f}' @@ -2125,7 +2126,8 @@ def extract_times_before_reset(self): get_time_before_reset = False # Check if event is a reset. - if entry.type == MessageType.EVENT_NOTIFICATION and payload.event_type == EventType.RESET: + if (entry.type == MessageType.EVENT_NOTIFICATION and + payload.event_type in (EventType.RESET_REQUESTED, EventType.RESET_COMPLETE)): curr_reset_time = payload.get_system_time_ns() get_time_before_reset = True except Exception as e: diff --git a/python/fusion_engine_client/messages/control.py b/python/fusion_engine_client/messages/control.py index ff74389c..1a43f68b 100644 --- a/python/fusion_engine_client/messages/control.py +++ b/python/fusion_engine_client/messages/control.py @@ -487,10 +487,11 @@ def calcsize(self) -> int: class EventType(IntEnum): LOG = 0 - RESET = 1 + RESET_REQUESTED = 1 CONFIG_CHANGE = 2 COMMAND = 3 COMMAND_RESPONSE = 4 + RESET_COMPLETE = 1 class EventNotificationMessage(MessagePayload): diff --git a/src/point_one/fusion_engine/messages/control.h b/src/point_one/fusion_engine/messages/control.h index bf515f52..796769e6 100644 --- a/src/point_one/fusion_engine/messages/control.h +++ b/src/point_one/fusion_engine/messages/control.h @@ -485,11 +485,20 @@ struct P1_ALIGNAS(4) EventNotificationMessage : public MessagePayload { */ LOG = 0, /** - * Event indicating a device reset occurred. The event flags will be set to - * the requested reset bitmask, if applicable (see @ref ResetRequest). The - * payload will contain a string describing the cause of the reset. + * Event indicating a device reset has been requested. + * + * For certain devices and types of resets, it may take time to fully apply + * all reset actions and it may not be possible to complete immediately. A + * `RESET_REQUESTED` event indicates the start of the reset process, and + * `RESET_COMPLETE` indicates when all actions have finished. Other types + * of reset may complete immediately, in which case both `RESET_REQUESTED` + * and `RESET_COMPLETE` messages will be sent at the same time. + * + * The `flags` field in the message will be set to the requested reset + * bitmask, if applicable (see @ref ResetRequest). The payload will contain + * a string describing the cause of the reset. */ - RESET = 1, + RESET_REQUESTED = 1, /** * Notification that the user configuration has been changed. Intended for * diagnostic purposes. @@ -506,6 +515,11 @@ struct P1_ALIGNAS(4) EventNotificationMessage : public MessagePayload { * will receive the response itself. */ COMMAND_RESPONSE = 4, + /** + * Event indicating a requested reset has finished. See `RESET_REQUESTED` + * for more details. + */ + RESET_COMPLETE = 5, }; static P1_CONSTEXPR_FUNC const char* to_string(EventType type) { @@ -513,8 +527,8 @@ struct P1_ALIGNAS(4) EventNotificationMessage : public MessagePayload { case EventType::LOG: return "Log"; - case EventType::RESET: - return "Reset"; + case EventType::RESET_REQUESTED: + return "Reset Requested"; case EventType::CONFIG_CHANGE: return "Config Change"; @@ -525,6 +539,9 @@ struct P1_ALIGNAS(4) EventNotificationMessage : public MessagePayload { case EventType::COMMAND_RESPONSE: return "Command Response"; + case EventType::RESET_COMPLETE: + return "Reset Complete"; + default: return "Unknown"; }