fix: don't manually re-arm SRQ in menu nav
This commit is contained in:
106
main.c
106
main.c
@@ -2184,14 +2184,15 @@ static void enter_menu_mode(void) {
|
||||
save_dmm_state();
|
||||
// Trigger Hold (T4) to make sure no new measurements
|
||||
// interrupt our display while we're going through the menu
|
||||
gpib_send(sys_cfg.dmm_addr, HP3478A_TRIG_HOLD);
|
||||
// also clear SRQ here manually so we don't increment menu entry
|
||||
// the earlier we clear status bits, the better
|
||||
gpib_send(sys_cfg.dmm_addr, HP3478A_TRIG_HOLD HP3478A_CMD_SRQ_CLEAR);
|
||||
|
||||
app.current_mode = MODE_MENU;
|
||||
app.menu_pos = MENU_REL;
|
||||
app.data.menu.timer = millis();
|
||||
|
||||
dmm_display("M: REL", HP3478A_DISP_TEXT_FAST);
|
||||
gpib_send(sys_cfg.dmm_addr, HP3478A_CMD_MASK_BTN_ONLY HP3478A_CMD_SRQ_CLEAR);
|
||||
}
|
||||
|
||||
static void handle_feature_logic(void) {
|
||||
@@ -2675,11 +2676,6 @@ static void handle_menu_navigation(void) {
|
||||
// update display
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
|
||||
// re-arm SRQ
|
||||
gpib_send(sys_cfg.dmm_addr,
|
||||
HP3478A_CMD_MASK_BTN_ONLY HP3478A_CMD_SRQ_CLEAR);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2694,62 +2690,64 @@ static void handle_menu_navigation(void) {
|
||||
if (dots > 3) dots = 3;
|
||||
|
||||
for (int i = 0; i < dots; i++) strcat(scratch.disp.full_cmd, ".");
|
||||
|
||||
// this does a strncmp every time :c
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
}
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
|
||||
if (elapsed > sys_cfg.menu_commit_delay_ms) {
|
||||
// L0: main menu
|
||||
if (app.data.menu.layer == SUBMENU_NONE) {
|
||||
if (app.menu_pos == MENU_TEMP) {
|
||||
// sensor select
|
||||
app.data.menu.layer = SUBMENU_TEMP_SENS;
|
||||
app.menu_pos = 0; // default to first sensor
|
||||
app.data.menu.timer = now;
|
||||
if (elapsed <= sys_cfg.menu_commit_delay_ms) return;
|
||||
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
return;
|
||||
}
|
||||
// enter standard modes
|
||||
enter_feature_mode(app.menu_pos);
|
||||
// L0: main menu
|
||||
if (app.data.menu.layer == SUBMENU_NONE) {
|
||||
if (app.menu_pos == MENU_TEMP) {
|
||||
// sensor select
|
||||
app.data.menu.layer = SUBMENU_TEMP_SENS;
|
||||
app.menu_pos = 0; // default to first sensor
|
||||
app.data.menu.timer = now;
|
||||
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
return;
|
||||
}
|
||||
// enter standard modes
|
||||
enter_feature_mode(app.menu_pos);
|
||||
return;
|
||||
}
|
||||
|
||||
// L1: sensor select
|
||||
else if (app.data.menu.layer == SUBMENU_TEMP_SENS) {
|
||||
app.temp_sensor = (temp_sensor_t)app.menu_pos;
|
||||
// L1: sensor select
|
||||
else if (app.data.menu.layer == SUBMENU_TEMP_SENS) {
|
||||
app.temp_sensor = (temp_sensor_t)app.menu_pos;
|
||||
|
||||
if (app.temp_sensor == SENS_TYPE_K) {
|
||||
// Type K is voltage based so skip wire select
|
||||
enter_feature_mode(MENU_TEMP);
|
||||
} else if (app.temp_sensor == SENS_THERMISTOR) {
|
||||
app.data.menu.layer = SUBMENU_TEMP_NTC;
|
||||
app.menu_pos = 0; // default to 10K
|
||||
app.data.menu.timer = now;
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
} else {
|
||||
// wire select (for resistive)
|
||||
app.data.menu.layer = SUBMENU_TEMP_WIRE;
|
||||
app.menu_pos = 0; // default to 2W
|
||||
app.data.menu.timer = now;
|
||||
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// L2a: wire select
|
||||
else if (app.data.menu.layer == SUBMENU_TEMP_WIRE) {
|
||||
app.temp_wire_mode = (wire_mode_t)app.menu_pos;
|
||||
if (app.temp_sensor == SENS_TYPE_K) {
|
||||
// Type K is voltage based so skip wire select
|
||||
enter_feature_mode(MENU_TEMP);
|
||||
return;
|
||||
} // L2b: NTC select
|
||||
else if (app.data.menu.layer == SUBMENU_TEMP_NTC) {
|
||||
app.temp_ntc_preset = (ntc_preset_t)app.menu_pos;
|
||||
enter_feature_mode(MENU_TEMP);
|
||||
return;
|
||||
} else if (app.temp_sensor == SENS_THERMISTOR) {
|
||||
app.data.menu.layer = SUBMENU_TEMP_NTC;
|
||||
app.menu_pos = 0; // default to 10K
|
||||
app.data.menu.timer = now;
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
} else {
|
||||
// wire select (for resistive)
|
||||
app.data.menu.layer = SUBMENU_TEMP_WIRE;
|
||||
app.menu_pos = 0; // default to 2W
|
||||
app.data.menu.timer = now;
|
||||
|
||||
prepare_menu_base_string();
|
||||
dmm_display(scratch.disp.full_cmd, HP3478A_DISP_TEXT_FAST);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// L2a: wire select
|
||||
else if (app.data.menu.layer == SUBMENU_TEMP_WIRE) {
|
||||
app.temp_wire_mode = (wire_mode_t)app.menu_pos;
|
||||
enter_feature_mode(MENU_TEMP);
|
||||
return;
|
||||
} // L2b: NTC select
|
||||
else if (app.data.menu.layer == SUBMENU_TEMP_NTC) {
|
||||
app.temp_ntc_preset = (ntc_preset_t)app.menu_pos;
|
||||
enter_feature_mode(MENU_TEMP);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user