MCPcopy Create free account
hub / github.com/UtilitechAS/amsreader-firmware / modifyMonthPlot

Method modifyMonthPlot

lib/SvelteUi/src/AmsWebServer.cpp:2782–2805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2780}
2781
2782void AmsWebServer::modifyMonthPlot() {
2783 if(!checkSecurity(1))
2784 return;
2785
2786 for(uint8_t i = 1; i <= 31; i++) {
2787 snprintf_P(buf, BufferSize, PSTR("i%02d"), i);
2788 if(server.hasArg(buf)) {
2789 ds->setDayImport(i, server.arg(buf).toDouble() * 1000);
2790 }
2791 snprintf_P(buf, BufferSize, PSTR("e%02d"), i);
2792 if(server.hasArg(buf)) {
2793 ds->setDayExport(i, server.arg(buf).toDouble() * 1000);
2794 }
2795 }
2796 bool ret = ds->save();
2797
2798 snprintf_P(buf, BufferSize, RESPONSE_JSON,
2799 "true",
2800 "",
2801 ret ? "true" : "false"
2802 );
2803 server.setContentLength(strlen(buf));
2804 server.send(200, MIME_JSON, buf);
2805}
2806
2807void AmsWebServer::addConditionalCloudHeaders() {
2808 server.sendHeader(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_AMSLESER_CLOUD);

Callers

nothing calls this directly

Calls 3

setDayImportMethod · 0.80
setDayExportMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected