fix manual override.

calib-gui
Ondřej Hruška 2 years ago
parent dc445af419
commit b6ccfd7019
  1. 22
      Core/Src/Gui/screen_calibration.c
  2. 2
      Core/Src/app_heater.c
  3. 2
      Core/Src/app_temp.c

@ -35,13 +35,13 @@ static void next_phase() {
s_calib.phase++; s_calib.phase++;
} }
static const char* calib0_opts[] = { static const char* hello_menu_opts[] = {
"Pokračovat", "Pokračovat",
"Zrušit", "Zrušit",
NULL NULL
}; };
static void calib0_cb(int opt) { static void hello_menu_cb(int opt) {
switch (opt) { switch (opt) {
case 0: case 0:
// Continue // Continue
@ -57,16 +57,13 @@ static void calib0_cb(int opt) {
} }
static const char* calib1_opts[] = { static const char* sample1_menu_opts[] = {
"Vzorek 1", "Vzorek 1",
"Zrušit", "Zrušit",
NULL NULL
}; };
static void sample1_menu_cb(int opt) {
static void calib1_cb(int opt) {
switch (opt) { switch (opt) {
case 0: case 0:
// Continue // Continue
@ -83,14 +80,14 @@ static void calib1_cb(int opt) {
} }
} }
static const char* calib3_opts[] = { static const char* sample2_menu_opts[] = {
"Vzorek 2", "Vzorek 2",
"Zrušit", "Zrušit",
NULL NULL
}; };
static void calib3_cb(int opt) { static void sample2_menu_cb(int opt) {
switch (opt) { switch (opt) {
case 0: case 0:
// Continue // Continue
@ -121,7 +118,7 @@ void screen_calibration(GuiEvent event)
fb_text(FBW/2, 16, "Vychlaď", TEXT_CENTER, 1); fb_text(FBW/2, 16, "Vychlaď", TEXT_CENTER, 1);
fb_text(FBW/2, 26, "troubu", TEXT_CENTER, 1); fb_text(FBW/2, 26, "troubu", TEXT_CENTER, 1);
} }
screen_menu_offset(event, calib0_opts, calib0_cb, 30); screen_menu_offset(event, hello_menu_opts, hello_menu_cb, 30);
break; break;
case PH_SAMPLE1: // Heater is active, waiting for mark case PH_SAMPLE1: // Heater is active, waiting for mark
@ -131,9 +128,9 @@ void screen_calibration(GuiEvent event)
fb_text(FBW/2, 26, "teplotu", TEXT_CENTER, 1); fb_text(FBW/2, 26, "teplotu", TEXT_CENTER, 1);
} }
if (s_calib.phase == PH_SAMPLE1) { if (s_calib.phase == PH_SAMPLE1) {
screen_menu_offset(event, calib1_opts, calib1_cb, 30); screen_menu_offset(event, sample1_menu_opts, sample1_menu_cb, 30);
} else { } else {
screen_menu_offset(event, calib3_opts, calib3_cb, 30); screen_menu_offset(event, sample2_menu_opts, sample2_menu_cb, 30);
} }
break; break;
@ -200,6 +197,7 @@ void screen_calibration(GuiEvent event)
app_temp_set_calib(a, b); app_temp_set_calib(a, b);
} else { } else {
// for the next phase
app_heater_manual_override(100); app_heater_manual_override(100);
} }
break; break;

@ -146,7 +146,7 @@ void app_task_heater(void *argument)
if (state.manual_override >= 0 && state.manual_override <= 100) { if (state.manual_override >= 0 && state.manual_override <= 100) {
PRINTF("manual override %d%%\r\n", state.manual_override); PRINTF("manual override %d%%\r\n", state.manual_override);
heater_pwm_set_perc(state.pid.Output); heater_pwm_set_perc(state.manual_override);
} else { } else {
PID_Compute(&state.pid, state.oven_temp); PID_Compute(&state.pid, state.oven_temp);
if (state.pid.ctlMode == PID_AUTOMATIC) { if (state.pid.ctlMode == PID_AUTOMATIC) {

@ -313,7 +313,7 @@ void app_temp_sample()
float y = s_analog.cal_a * sum + s_analog.cal_b; float y = s_analog.cal_a * sum + s_analog.cal_b;
float actual_temp = val_to_c(y); float actual_temp = val_to_c(y);
// PRINTF("Compensated x %f -> y %f, temp %f C\r\n", sum, y, actual_temp); PRINTF("T raw %f %f -> comp %f, temp %f°C\r\n", sum, y, actual_temp);
s_analog.oven_temp = actual_temp; s_analog.oven_temp = actual_temp;
s_analog.oven_temp_raw = sum; s_analog.oven_temp_raw = sum;

Loading…
Cancel
Save