Browse Source

print picowota status messages on lcd

Thomas Buck 1 year ago
parent
commit
e2570e1633
3 changed files with 28 additions and 6 deletions
  1. 8
    0
      data/fonts.h
  2. 1
    1
      picowota
  3. 19
    5
      src/ota_shim.c

+ 8
- 0
data/fonts.h View File

1
 // don't include _all_ fonts, to reduce size
1
 // don't include _all_ fonts, to reduce size
2
+#ifdef PICOWOTA
3
+
4
+#include "../mcufont/fonts/fixed_5x8.c"
5
+
6
+#else // PICOWOTA
7
+
2
 #include "../mcufont/fonts/DejaVuSerif16.c"
8
 #include "../mcufont/fonts/DejaVuSerif16.c"
3
 #include "../mcufont/fonts/DejaVuSerif32.c"
9
 #include "../mcufont/fonts/DejaVuSerif32.c"
4
 #include "../mcufont/fonts/fixed_10x20.c"
10
 #include "../mcufont/fonts/fixed_10x20.c"
11
+
12
+#endif // PICOWOTA

+ 1
- 1
picowota

1
-Subproject commit dd98bf620976a2df113cf03eeb2483a9e68c1d7d
1
+Subproject commit 682ce01a0ea6ae9d702d404e3e24894f904c277d

+ 19
- 5
src/ota_shim.c View File

16
  * See <http://www.gnu.org/licenses/>.
16
  * See <http://www.gnu.org/licenses/>.
17
  */
17
  */
18
 
18
 
19
+#include <stdarg.h>
20
+#include <stdio.h>
21
+
19
 #include "pico/cyw43_arch.h"
22
 #include "pico/cyw43_arch.h"
20
 
23
 
21
 #include "config.h"
24
 #include "config.h"
29
 #include "wifi.h"
32
 #include "wifi.h"
30
 
33
 
31
 static int16_t lcd_off = 0;
34
 static int16_t lcd_off = 0;
32
-static size_t text_window = 120;
35
+static size_t text_window = 420; // TODO
33
 static size_t text_off = 0;
36
 static size_t text_off = 0;
34
 static size_t prev_len = 0;
37
 static size_t prev_len = 0;
35
 static bool redraw = false;
38
 static bool redraw = false;
39
     memcpy(tmp, buf, len);
42
     memcpy(tmp, buf, len);
40
     tmp[len] = '\0';
43
     tmp[len] = '\0';
41
     lcd_off = text_box(tmp, false,
44
     lcd_off = text_box(tmp, false,
42
-                       "fixed_10x20",
45
+                       "fixed_5x8",
43
                        0, LCD_WIDTH,
46
                        0, LCD_WIDTH,
44
                        lcd_off, LCD_HEIGHT - lcd_off,
47
                        lcd_off, LCD_HEIGHT - lcd_off,
45
                        0);
48
                        0);
49
     // TODO length is not good as indicator.
52
     // TODO length is not good as indicator.
50
     // TODO will stop working when log buffer is filled.
53
     // TODO will stop working when log buffer is filled.
51
     size_t len = rb_len(log_get());
54
     size_t len = rb_len(log_get());
52
-    if (redraw || (len == prev_len)) {
55
+    if ((!redraw) && (len == prev_len)) {
53
         return;
56
         return;
54
     }
57
     }
55
     prev_len = len;
58
     prev_len = len;
91
     }
94
     }
92
 }
95
 }
93
 
96
 
97
+void picowota_printf_init(void) { }
98
+
99
+void picowota_printf(const char* format, ...) {
100
+    va_list args;
101
+    va_start(args, format);
102
+    debug_log_va(true, format, args);
103
+    va_end(args);
104
+
105
+    log_dump_to_lcd();
106
+}
107
+
94
 void picowota_poll(void) {
108
 void picowota_poll(void) {
95
     buttons_run();
109
     buttons_run();
96
     cyw43_arch_poll();
110
     cyw43_arch_poll();
98
     log_dump_to_lcd();
112
     log_dump_to_lcd();
99
 }
113
 }
100
 
114
 
101
-int picowota_network_init(void) {
115
+int picowota_init(void) {
102
     buttons_init();
116
     buttons_init();
103
     buttons_callback(ota_buttons);
117
     buttons_callback(ota_buttons);
104
     mem_load();
118
     mem_load();
140
     return 0;
154
     return 0;
141
 }
155
 }
142
 
156
 
143
-void picowota_network_deinit(void) {
157
+void picowota_deinit(void) {
144
     debug("wifi_deinit");
158
     debug("wifi_deinit");
145
     log_dump_to_lcd();
159
     log_dump_to_lcd();
146
 
160
 

Loading…
Cancel
Save