Procházet zdrojové kódy

print picowota status messages on lcd

Thomas Buck před 10 měsíci
rodič
revize
e2570e1633
3 změnil soubory, kde provedl 28 přidání a 6 odebrání
  1. 8
    0
      data/fonts.h
  2. 1
    1
      picowota
  3. 19
    5
      src/ota_shim.c

+ 8
- 0
data/fonts.h Zobrazit soubor

@@ -1,4 +1,12 @@
1 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 8
 #include "../mcufont/fonts/DejaVuSerif16.c"
3 9
 #include "../mcufont/fonts/DejaVuSerif32.c"
4 10
 #include "../mcufont/fonts/fixed_10x20.c"
11
+
12
+#endif // PICOWOTA

+ 1
- 1
picowota

@@ -1 +1 @@
1
-Subproject commit dd98bf620976a2df113cf03eeb2483a9e68c1d7d
1
+Subproject commit 682ce01a0ea6ae9d702d404e3e24894f904c277d

+ 19
- 5
src/ota_shim.c Zobrazit soubor

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

Loading…
Zrušit
Uložit