diff --git a/breath_button_monitor/breathmonitor_v3 with server/firmware/firmware.ino b/breath_button_monitor/breathmonitor_v3 with server/firmware/firmware.ino index eace42e..1810202 100644 --- a/breath_button_monitor/breathmonitor_v3 with server/firmware/firmware.ino +++ b/breath_button_monitor/breathmonitor_v3 with server/firmware/firmware.ino @@ -128,7 +128,7 @@ static String workerMessage(){char local[128];portENTER_CRITICAL(&gWorkerMux);st // Production HTTPS: this CA trusts Let's Encrypt certificates, including Caddy's default. // If Caddy uses a different issuer, replace this PEM and rebuild the firmware. static const char SERVER_URL[]="https://breathmonitor.shineup.me"; -static const char FIRMWARE_VERSION[]="1.2"; +static const char FIRMWARE_VERSION[]="1.3"; static const char ROOT_CA[] PROGMEM = R"CERT( -----BEGIN CERTIFICATE----- MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw @@ -1002,9 +1002,9 @@ static void firmwareConfirmScreen(lv_event_t *){ button(gRoot,"UPDATE",256,300,200,55,0x2A9D8F,[](lv_event_t *){networkStart(NetOperation::Firmware);firmwareScreen(nullptr);}); } static void firmwareScreen(lv_event_t *){ - gScreen=Screen::Firmware;clearUi();legend();topBar("FIRMWARE");char line[96];snprintf(line,sizeof(line),"Installed: %s\nStable: 1.2\nTest: 1.2",FIRMWARE_VERSION);lv_obj_t *t=label(gRoot,line,&lv_font_montserrat_20,0xFFFFFF);lv_obj_set_pos(t,28,100); + gScreen=Screen::Firmware;clearUi();legend();topBar("FIRMWARE");char line[96];snprintf(line,sizeof(line),"Installed: %s\nStable: 1.3\nTest: 1.2",FIRMWARE_VERSION);lv_obj_t *t=label(gRoot,line,&lv_font_montserrat_20,0xFFFFFF);lv_obj_set_pos(t,28,100); if(gNetOperation==NetOperation::Firmware||gWorkerActive){lv_obj_t *s=label(gRoot,workerMessage().c_str(),&lv_font_montserrat_16,0xFFD34D);lv_obj_set_pos(s,28,220);} - button(gRoot,"UPDATE STABLE",24,285,208,55,0x2A9D8F,[](lv_event_t *){gFirmwareTarget="1.2";firmwareConfirmScreen(nullptr);}); + button(gRoot,"UPDATE STABLE",24,285,208,55,0x2A9D8F,[](lv_event_t *){gFirmwareTarget="1.3";firmwareConfirmScreen(nullptr);}); button(gRoot,"UPDATE TEST",248,285,208,55,0xA56A36,[](lv_event_t *){gFirmwareTarget="1.2";firmwareConfirmScreen(nullptr);}); button(gRoot,"BACK",140,375,200,52,0x214D69,[](lv_event_t *){onlineSettings(nullptr);}); } diff --git a/breath_button_monitor/breathmonitor_v3 with server/server/BreathServer.java b/breath_button_monitor/breathmonitor_v3 with server/server/BreathServer.java index 568348b..e6bf357 100644 --- a/breath_button_monitor/breathmonitor_v3 with server/server/BreathServer.java +++ b/breath_button_monitor/breathmonitor_v3 with server/server/BreathServer.java @@ -441,8 +441,8 @@ public final class BreathServer { } private static String quoted(String s){return "\""+s.replace("\\","\\\\").replace("\"","\\\"")+"\"";} private static void serveWeb(HttpExchange x,String path,String method) throws Exception { - if(path.equals("/firmware/manifest.json")){byte[] bytes="{\"current\":\"1.2\",\"stable\":{\"version\":\"1.2\",\"file\":\"breathmonitor-v1.2.bin\"},\"test\":{\"version\":\"1.2\",\"file\":\"breathmonitor-v1.2.bin\"}}".getBytes(StandardCharsets.UTF_8);if(method.equals("HEAD")){x.getResponseHeaders().set("Content-Type","application/json; charset=utf-8");x.sendResponseHeaders(200,-1);}else send(x,200,"application/json; charset=utf-8",bytes);return;} - if(path.startsWith("/firmware/")){String resource=path.substring("/firmware/".length());if(!resource.matches("breathmonitor-v1\\.(1|2)\\.bin"))throw new HttpError(404,"Firmware not found");try(InputStream in=BreathServer.class.getResourceAsStream("/firmware/"+resource)){if(in==null)throw new HttpError(404,"Firmware not installed");byte[] bytes=in.readAllBytes();if(method.equals("HEAD")){x.getResponseHeaders().set("Content-Type","application/octet-stream");x.sendResponseHeaders(200,-1);}else send(x,200,"application/octet-stream",bytes);return;}} + if(path.equals("/firmware/manifest.json")){byte[] bytes="{\"current\":\"1.3\",\"stable\":{\"version\":\"1.3\",\"file\":\"breathmonitor-v1.3.bin\"},\"test\":{\"version\":\"1.2\",\"file\":\"breathmonitor-v1.2.bin\"}}".getBytes(StandardCharsets.UTF_8);if(method.equals("HEAD")){x.getResponseHeaders().set("Content-Type","application/json; charset=utf-8");x.sendResponseHeaders(200,-1);}else send(x,200,"application/json; charset=utf-8",bytes);return;} + if(path.startsWith("/firmware/")){String resource=path.substring("/firmware/".length());if(!resource.matches("breathmonitor-v1\\.(1|2|3)\\.bin"))throw new HttpError(404,"Firmware not found");try(InputStream in=BreathServer.class.getResourceAsStream("/firmware/"+resource)){if(in==null)throw new HttpError(404,"Firmware not installed");byte[] bytes=in.readAllBytes();if(method.equals("HEAD")){x.getResponseHeaders().set("Content-Type","application/octet-stream");x.sendResponseHeaders(200,-1);}else send(x,200,"application/octet-stream",bytes);return;}} String name = switch(path){case "/","/index.html" -> "index.html"; case "/app.js" -> "app.js";case "/style.css" -> "style.css"; default -> null;}; diff --git a/breath_button_monitor/breathmonitor_v3 with server/server/src/main/resources/firmware/breathmonitor-v1.3.bin b/breath_button_monitor/breathmonitor_v3 with server/server/src/main/resources/firmware/breathmonitor-v1.3.bin new file mode 100644 index 0000000..32382a9 Binary files /dev/null and b/breath_button_monitor/breathmonitor_v3 with server/server/src/main/resources/firmware/breathmonitor-v1.3.bin differ