commit 1da0c8e153fd530287a0758cc0d7a392d4f1adab
parent 466eef43a902fb940770dbb3f77162eb597c0d51
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Tue, 2 Jun 2026 23:36:32 -0300
Introducir seccion 3.2: "Firmware del sistema"
Agregar imágenes de los distintos estados del display
Diffstat:
9 files changed, 104 insertions(+), 0 deletions(-)
diff --git a/MEMORIA.md b/MEMORIA.md
@@ -522,4 +522,108 @@ El calefactor del derretidor de miel se modeló como una carga resistiva pura,
por lo que se utilizó un resistor de alta potencia de 12 V y 48 W para las
pruebas de laboratorio.
+## 3.2 Firmware del sistema
+
+### 3.2.1 Ejecutor cíclico
+
+El firmware implementa un ejecutor cíclico con tick de 1 ms generado por el
+SysTick del microcontrolador. En cada tick, la función `app_update()` recorre
+secuencialmente las ocho tareas registradas, ejecutando tantas iteraciones como
+ticks estén pendientes. De cualquier forma, en operación normal, se cumple
+que la función `app_update()` no se bloquea más que 1 ms, por lo que en cada
+tick del SysTick no debería haber más de una operación pendiente.
+
+Cada tarea sigue el patrón:
+
+1. Consulta su contador de ticks (incrementado por `HAL_SYSTICK_Callback`).
+2. Si hay ticks pendientes, ejecuta su máquina de estados o logica
+ correspondiente.
+3. Al finalizar, mide el tiempo de ejecución mediante el contador de ciclos del
+ DWT.
+
+En particular en el archivo `app.c` interesa mostrar la lista de tareas que se
+asocian a la aplicación el arreglo siguiente:
+
+```c
+const task_cfg_t task_cfg_list[] = {
+ {task_system_init, task_system_update, &shared_data},
+ {task_buttons_init, task_buttons_update, NULL},
+ {task_buzzer_init, task_buzzer_update, NULL},
+ {task_leds_init, task_leds_update, NULL},
+ {task_menu_init, task_menu_update, &shared_data},
+ {task_temp_ctrl_init, task_temp_ctrl_update, &shared_data},
+ {task_temp_sensor_init, task_temp_sensor_update, &shared_data},
+ {task_remote_init, task_remote_update, &shared_data},
+};
+```
+
+### 3.2.6 Tarea Menu
+
+Gestiona la actualización del display LCD 16x2 según el estado actual del
+sistema. Cada estado define su propio contenido de display. En modo idle se
+muestra:
+
+- Línea 1: Estado del calefactor ("On" + duty cycle % o "Idle").
+- Línea 2: Estado del timer ("[P]" si activo), temperatura actual y set point.
+
+La comunicación con el LCD es asíncrona: las operaciones se encolan y se
+procesan en el tick de la tarea mediante `display_i2c_async_tick()`.
+
+<div align="center">
+
+<table>
+
+<tr>
+<td align="center">
+<img src="img/lcd/lcd_idle.png" width="350px"><br>
+<em>(a) Sistema en reposo</em>
+</td>
+
+<td align="center">
+<img src="img/lcd/lcd_idle_prog.png" width="350px"><br>
+<em>(b) Sistema en reposo con timer programado</em>
+</td>
+</tr>
+
+<tr>
+<td align="center">
+<img src="img/lcd/lcd_clock_set.png" width="350px"><br>
+<em>(c) Configuracio de reloj.</em>
+</td>
+
+<td align="center">
+<img src="img/lcd/lcd_on.png" width="350px"><br>
+<em>(d) Sitema operando el calefactor</em>
+</td>
+</tr>
+
+<tr>
+<td align="center">
+<img src="img/lcd/lcd_temp_set.png" width="350px"><br>
+<em>(e) Configuracion de temperatura deseada.</em>
+</td>
+
+<td align="center">
+<img src="img/lcd/lcd_timer_set_end.png" width="350px"><br>
+<em>(f) Configuracion de fin de timer.</em>
+</td>
+</tr>
+
+<tr>
+<td align="center">
+<img src="img/lcd/lcd_timer_set.png" width="350px"><br>
+<em>(g) Configuracion de encendido/apagado de timer.</em>
+</td>
+
+<td align="center">
+<img src="img/lcd/lcd_timer_set_start.png" width="350px"><br>
+<em>(h) Configuracion de inicio de timer.</em>
+</td>
+</tr>
+
+</table>
+
+<em>Figura 3.5: Interfaces mostradas en el display LCD 16x2.</em>
+</div>
+
diff --git a/img/lcd/lcd_clock_set.png b/img/lcd/lcd_clock_set.png
Binary files differ.
diff --git a/img/lcd/lcd_idle.png b/img/lcd/lcd_idle.png
Binary files differ.
diff --git a/img/lcd/lcd_idle_prog.png b/img/lcd/lcd_idle_prog.png
Binary files differ.
diff --git a/img/lcd/lcd_on.png b/img/lcd/lcd_on.png
Binary files differ.
diff --git a/img/lcd/lcd_temp_set.png b/img/lcd/lcd_temp_set.png
Binary files differ.
diff --git a/img/lcd/lcd_timer_set.png b/img/lcd/lcd_timer_set.png
Binary files differ.
diff --git a/img/lcd/lcd_timer_set_end.png b/img/lcd/lcd_timer_set_end.png
Binary files differ.
diff --git a/img/lcd/lcd_timer_set_start.png b/img/lcd/lcd_timer_set_start.png
Binary files differ.