Собрать и опубликовать стабильную прошивку 1.3

This commit is contained in:
AidarKC
2026-10-26 19:06:54 +03:00
parent b674a87d64
commit 02ce542196
3 changed files with 5 additions and 5 deletions
@@ -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);});
}
@@ -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;};