@@ -91,8 +91,16 @@ uint8_t scale_calibrate_with_external_weight() {
9191 strcpy (line1 , "Confirm pan is empty" );
9292 strcpy (line2 , "Press Next to continue" );
9393 show_next_key = true;
94- while (button_wait_for_input (true) != BUTTON_ENCODER_PRESSED ) {
95- ;
94+ while (true) {
95+ ButtonEncoderEvent_t ev = button_wait_for_input (true);
96+ if (ev == BUTTON_RST_PRESSED ) {
97+ show_next_key = false;
98+ vTaskSuspend (scale_calibration_render_task_handler );
99+ return 31 ; // back to Scale menu
100+ }
101+ if (ev == BUTTON_ENCODER_PRESSED ) {
102+ break ;
103+ }
96104 }
97105 show_next_key = false;
98106 scale_press_print_key ();
@@ -108,8 +116,16 @@ uint8_t scale_calibrate_with_external_weight() {
108116 strcpy (line2 , "Press Next to continue" );
109117
110118 show_next_key = true;
111- while (button_wait_for_input (true) != BUTTON_ENCODER_PRESSED ) {
112- ;
119+ while (true) {
120+ ButtonEncoderEvent_t ev = button_wait_for_input (true);
121+ if (ev == BUTTON_RST_PRESSED ) {
122+ show_next_key = false;
123+ vTaskSuspend (scale_calibration_render_task_handler );
124+ return 31 ; // back to Scale menu
125+ }
126+ if (ev == BUTTON_ENCODER_PRESSED ) {
127+ break ;
128+ }
113129 }
114130 show_next_key = false;
115131 scale_press_print_key ();
@@ -124,8 +140,16 @@ uint8_t scale_calibrate_with_external_weight() {
124140 strcpy (line2 , "Press Next to continue" );
125141
126142 show_next_key = true;
127- while (button_wait_for_input (true) != BUTTON_ENCODER_PRESSED ) {
128- ;
143+ while (true) {
144+ ButtonEncoderEvent_t ev = button_wait_for_input (true);
145+ if (ev == BUTTON_RST_PRESSED ) {
146+ show_next_key = false;
147+ vTaskSuspend (scale_calibration_render_task_handler );
148+ return 31 ; // back to Scale menu
149+ }
150+ if (ev == BUTTON_ENCODER_PRESSED ) {
151+ break ;
152+ }
129153 }
130154 show_next_key = false;
131155
0 commit comments