Skip to content

Commit

Permalink
Merge pull request #508 from Paciente8159/system-menu-alarm-info
Browse files Browse the repository at this point in the history
added components for better system menu alarm info
  • Loading branch information
Paciente8159 committed Sep 22, 2023
2 parents 412a94f + abcf779 commit fa7ba3d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions uCNC/src/cnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ bool cnc_has_alarm()
return (cnc_get_exec_state(EXEC_KILL) || (cnc_state.alarm != EXEC_ALARM_NOALARM));
}

uint8_t cnc_get_alarm(void)
{
return cnc_state.alarm;
}

void cnc_stop(void)
{
itp_stop();
Expand Down
3 changes: 2 additions & 1 deletion uCNC/src/cnc.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ extern "C"
bool cnc_dotasks(void);
void cnc_home(void);
void cnc_alarm(int8_t code);
bool cnc_has_alarm();
bool cnc_has_alarm(void);
uint8_t cnc_get_alarm(void);
void cnc_stop(void);
uint8_t cnc_unlock(bool force);
void cnc_delay_ms(uint32_t miliseconds);
Expand Down
15 changes: 15 additions & 0 deletions uCNC/src/modules/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ extern "C"
#define STR_SETTINGS_LOADED "Settings loaded"
#define STR_SETTINGS_SAVED "Settings saved"
#define STR_SETTINGS_RESET "Settings reset"
// alarms
#define STR_ALARM_0 "Unknowned"
#define STR_ALARM_1 "Hard limits hit"
#define STR_ALARM_2 "Soft limits hit"
#define STR_ALARM_3 "Aborted by user"
#define STR_ALARM_4 "Probe hit"
#define STR_ALARM_5 "Probe no hit"
#define STR_ALARM_6 "Home reset"
#define STR_ALARM_7 "Door opened"
#define STR_ALARM_8 "Limits in contact"
#define STR_ALARM_9 "Failed home find"
#define STR_ALARM_10 "Failed autolevel"
#define STR_ALARM_11 "Limits are active"
#define STR_ALARM_12 "Tool sync fail"
#define STR_ALARM_13 "Limits tripped"

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions uCNC/src/modules/system_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ void system_menu_action(uint8_t action)
// kill alarm is active
if (cnc_get_exec_state(EXEC_INTERLOCKING_FAIL) || cnc_has_alarm())
{
// never go idle
g_system_menu.action_timeout = UINT32_MAX;
// go idle (like popup) if normalized
g_system_menu.action_timeout = mcu_millis() + SYSTEM_MENU_MODAL_POPUP_MS;
g_system_menu.flags |= SYSTEM_MENU_MODE_REDRAW;
// leave. ignore all actions
return;
Expand Down

0 comments on commit fa7ba3d

Please sign in to comment.