|
@@ -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
|
|