From 963289c8410b3094fbf118eb8f96c6ae8e839721 Mon Sep 17 00:00:00 2001 From: Sebastian Fernandez <sebfer@fing.edu.uy> Date: Thu, 11 Feb 2021 08:35:46 -0300 Subject: [PATCH] se muestra version a arrancar --- sw/uv_meter_arduino/uv_meter_arduino.ino | 58 +++++++++++++++++++----- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/sw/uv_meter_arduino/uv_meter_arduino.ino b/sw/uv_meter_arduino/uv_meter_arduino.ino index 358ec79..df036a7 100755 --- a/sw/uv_meter_arduino/uv_meter_arduino.ino +++ b/sw/uv_meter_arduino/uv_meter_arduino.ino @@ -36,6 +36,12 @@ * 1) Al grabar valores en la EEPROM, en forma aleatoria el sw no funciona correctamente. * Se opta por no incluir por el momento el registro de los minutos de funcionamiento y ciclos de uso. * + * * v1.22 - 2021/02/11 - S.Fernandez + * Se agrega estados para + * - al arrancar mostrar el numero de version y pedir que presione boton. + * - al terminar de calibrar indicar que esta listo para usar + * + * * Timer idea * https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/ * @@ -103,7 +109,7 @@ por /**************************************** * User parameters ****************************************/ -#define version "Version 1.21" +#define version "Ver 1.22" // UV metering const float target_dose = 2000; // 2000 mJ/cm2 const float min_percent_initial_adc = 0.45; @@ -207,7 +213,7 @@ int total_desinfection_time; // seconds int remaining_desinfection_time; // States -enum State_enum {POWER_UP, CALIBRATE_WAIT, CALIBRATE_POWER, DOSE_CALCULATION, WAIT_TO_START, \ +enum State_enum {POWER_UP, CALIBRATE_WAIT, CALIBRATE_POWER, DOSE_CALCULATION, CALIBRATION_DONE, WAIT_TO_START, \ DOSE_APPLY, DOSE_END_NOTIFICATION, WAIT_UNLOAD, \ AL_DOOR_OPEN_WHEN_DOSE_APPLYING, ERROR_POWER }; @@ -401,9 +407,9 @@ void display_calibration_warming(int value) { lcd.setCursor(0, 0); lcd.print("Calib. en curso "); // lcd.setCursor(0, 1); - lcd.print("Calentando: "); // + lcd.print("Calentando:"); // lcd.print(value); - lcd.print(" s "); // + lcd.print("s "); // } void display_msg_door() { //76543210 @@ -455,6 +461,21 @@ void display_msg_end() { } +void display_show_version() { + + lcd.setCursor(0, 0); + lcd.print(version); // + lcd.setCursor(0, 1); + lcd.print("Presione boton"); // +} + +void display_calibration_done() { + + lcd.setCursor(0, 0); + lcd.print("Fin calibracion "); // + lcd.setCursor(0, 1); + lcd.print("Presione boton "); // +} void display_power_time(int disp, int value) { char digitos_disp[4] = {}; int first_digit_pos; @@ -641,13 +662,17 @@ switch(state) case POWER_UP: DEBUGST_PRINT("state: POWER_UP"); - if (uvc_sensor_present == 0){ - radiation_power = calculate_radiation_power(uvc_read_def); - state = DOSE_CALCULATION; - } else { - radiation_power = 0; - state = CALIBRATE_WAIT; + if (check_button_pressed()==HIGH){ + if (uvc_sensor_present == 0){ + radiation_power = calculate_radiation_power(uvc_read_def); + state = DOSE_CALCULATION; + } else { + radiation_power = 0; + state = CALIBRATE_WAIT; + } } + + display_show_version(); load_detected = LOW; tics_gral_passed = 0; @@ -700,7 +725,7 @@ switch(state) state = ERROR_POWER; } else { display_calibration_power(radiation_power); - state = DOSE_CALCULATION; + state = CALIBRATION_DONE; } } else { tics_gral_passed += 1; @@ -711,6 +736,17 @@ switch(state) break; + /////////////////////////////////////// + case CALIBRATION_DONE: + DEBUGST_PRINT("state: CALIBRATION_DONE"); + if (check_button_pressed()==HIGH){ + state = DOSE_CALCULATION; + + } + display_calibration_done(); + + break; + /////////////////////////////////////// case DOSE_CALCULATION: DEBUGST_PRINT("state: DOSE_CALCULATION"); -- GitLab