Ver código fonte

reset to ota function

Thomas Buck 5 meses atrás
pai
commit
f0aafe0ba3
7 arquivos alterados com 14 adições e 14 exclusões
  1. 1
    0
      include/util.h
  2. 1
    2
      src/console.c
  3. 0
    1
      src/mem.c
  4. 2
    0
      src/state_about.c
  5. 2
    2
      src/state_scan.c
  6. 2
    3
      src/state_settings.c
  7. 6
    6
      src/util.c

+ 1
- 0
include/util.h Ver arquivo

@@ -26,6 +26,7 @@ int32_t convert_two_complement(int32_t b);
26 26
 
27 27
 bool str_startswith(const char *str, const char *start);
28 28
 
29
+void reset_to_ota(void);
29 30
 void reset_to_bootloader(void);
30 31
 void reset_to_main(void);
31 32
 

+ 1
- 2
src/console.c Ver arquivo

@@ -23,7 +23,6 @@
23 23
 
24 24
 #include "pico/stdlib.h"
25 25
 #include "hardware/watchdog.h"
26
-#include "picowota/reboot.h"
27 26
 
28 27
 #include "config.h"
29 28
 #include "log.h"
@@ -139,7 +138,7 @@ static void cnsl_interpret(const char *line) {
139 138
     } else if (strcmp(line, "reset") == 0) {
140 139
         reset_to_main();
141 140
     } else if (strcmp(line, "ota") == 0) {
142
-        picowota_reboot(true);
141
+        reset_to_ota();
143 142
     } else if (strcmp(line, "mount") == 0) {
144 143
         bool state = msc_is_medium_available();
145 144
         println("Currently %s. %s now.",

+ 0
- 1
src/mem.c Ver arquivo

@@ -114,7 +114,6 @@ void mem_load(void) {
114 114
         } else {
115 115
             debug("loading from flash (0x%08lX)", checksum);
116 116
             data_ram = *flash_ptr;
117
-            debug("%s", data_ram.data.net[0].pass);
118 117
         }
119 118
     } else {
120 119
         debug("invalid config (0x%02X != 0x%02X)", flash_ptr->version, MEM_VERSION);

+ 2
- 0
src/state_about.c Ver arquivo

@@ -53,6 +53,8 @@ static const char *about_text =
53 53
     "bluekitchen/btstack\n"
54 54
     "mcufont/mcufont\n"
55 55
     "hepingood/st7789\n"
56
+    "usedbytes/picowota\n"
57
+    "lwip-tcpip/lwip\n"
56 58
     "\n"
57 59
 
58 60
     "This program is free software: you can redistribute it and/or modify "

+ 2
- 2
src/state_scan.c Ver arquivo

@@ -20,13 +20,13 @@
20 20
 #include <string.h>
21 21
 
22 22
 #include "pico/stdlib.h"
23
-#include "picowota/reboot.h"
24 23
 
25 24
 #include "config.h"
26 25
 #include "ble.h"
27 26
 #include "models.h"
28 27
 #include "mem.h"
29 28
 #include "menu.h"
29
+#include "util.h"
30 30
 #include "state.h"
31 31
 #include "state_workflow.h"
32 32
 #include "state_volcano_run.h"
@@ -103,7 +103,7 @@ static void edit_cb(int selection) {
103 103
 
104 104
 static void ota_cb(int selection) {
105 105
     UNUSED(selection);
106
-    picowota_reboot(true);
106
+    reset_to_ota();
107 107
 }
108 108
 
109 109
 void state_scan_enter(void) {

+ 2
- 3
src/state_settings.c Ver arquivo

@@ -19,13 +19,12 @@
19 19
 #include <stdio.h>
20 20
 #include <string.h>
21 21
 
22
-#include "picowota/reboot.h"
23
-
24 22
 #include "config.h"
25 23
 #include "log.h"
26 24
 #include "main.h"
27 25
 #include "menu.h"
28 26
 #include "mem.h"
27
+#include "util.h"
29 28
 #include "state.h"
30 29
 #include "state_value.h"
31 30
 #include "state_workflow.h"
@@ -85,7 +84,7 @@ static void enter_cb(int selection) {
85 84
 
86 85
     case 6:
87 86
         // OTA Update
88
-        picowota_reboot(true);
87
+        reset_to_ota();
89 88
         break;
90 89
 
91 90
     default:

+ 6
- 6
src/util.c Ver arquivo

@@ -19,7 +19,7 @@
19 19
 #include <string.h>
20 20
 #include "pico/stdlib.h"
21 21
 #include "pico/bootrom.h"
22
-#include "hardware/watchdog.h"
22
+#include "picowota/reboot.h"
23 23
 
24 24
 #ifdef CYW43_WL_GPIO_LED_PIN
25 25
 #include "pico/cyw43_arch.h"
@@ -81,12 +81,12 @@ void reset_to_bootloader(void) {
81 81
 #endif // PICO_DEFAULT_LED_PIN
82 82
 }
83 83
 
84
+void reset_to_ota(void) {
85
+    picowota_reboot(true);
86
+}
87
+
84 88
 void reset_to_main(void) {
85
-    watchdog_enable(1, 1);
86
-    while (1) {
87
-        // wait 1ms until watchdog kills us
88
-        asm volatile("nop");
89
-    }
89
+    picowota_reboot(false);
90 90
 }
91 91
 
92 92
 void hexdump(const uint8_t *buff, size_t len) {

Carregando…
Cancelar
Salvar