Browse Source

wip print version

Thomas Buck 8 months ago
parent
commit
a4c997e0a5
3 changed files with 25 additions and 0 deletions
  1. 1
    0
      include/lcd.h
  2. 7
    0
      src/lcd.c
  3. 17
    0
      src/main.c

+ 1
- 0
include/lcd.h View File

28
 void lcd_draw(const char *mode, const char *val, const char *bat);
28
 void lcd_draw(const char *mode, const char *val, const char *bat);
29
 void lcd_draw_bye(void);
29
 void lcd_draw_bye(void);
30
 void lcd_draw_bitmap(uint8_t *data, int width, int height, int x_off, int y_off);
30
 void lcd_draw_bitmap(uint8_t *data, int width, int height, int x_off, int y_off);
31
+void lcd_draw_version(void);
31
 
32
 
32
 void lcd_debug_buttons(void);
33
 void lcd_debug_buttons(void);
33
 
34
 

+ 7
- 0
src/lcd.c View File

135
     ssd1306_draw_string(&disp, 8, LCD_HEIGHT / 2 + 5, 3, "loader");
135
     ssd1306_draw_string(&disp, 8, LCD_HEIGHT / 2 + 5, 3, "loader");
136
     ssd1306_show(&disp);
136
     ssd1306_show(&disp);
137
 }
137
 }
138
+
139
+void lcd_draw_version(void) {
140
+    ssd1306_clear(&disp);
141
+    // TODO
142
+    ssd1306_draw_string(&disp, 0, LCD_HEIGHT / 2 - 4, 1, "TODO");
143
+    ssd1306_show(&disp);
144
+}

+ 17
- 0
src/main.c View File

100
         lcd_debug_buttons();
100
         lcd_debug_buttons();
101
     } else if (debug_buttons[BTN_REC] && (!debug_buttons[BTN_CLICK])) {
101
     } else if (debug_buttons[BTN_REC] && (!debug_buttons[BTN_CLICK])) {
102
         // skip splash screen
102
         // skip splash screen
103
+    } else if ((!debug_buttons[BTN_REC]) && debug_buttons[BTN_CLICK]) {
104
+        // show version info
105
+        lcd_draw_version();
106
+
107
+        // wait until button is released
108
+        uint32_t last = to_ms_since_boot(get_absolute_time());
109
+        bool state = false;
110
+        while (debug_buttons[BTN_CLICK]) {
111
+            buttons_run();
112
+            handle_serial_input();
113
+            uint32_t now = to_ms_since_boot(get_absolute_time());
114
+            if ((now - last) >= 250) {
115
+                state = !state;
116
+                led_set(0, state);
117
+            }
118
+        }
119
+        led_set(0, false);
103
     } else {
120
     } else {
104
         // show splash for a bit and animate LEDs
121
         // show splash for a bit and animate LEDs
105
         for (uint i = 0; i < LED_COUNT; i++) {
122
         for (uint i = 0; i < LED_COUNT; i++) {

Loading…
Cancel
Save