Skip to content

Commit

Permalink
Merge pull request #23 from softwarecrash/bugfix-2.0.0
Browse files Browse the repository at this point in the history
🐛 Fix Potential exception when reading data from progmem
🐛 Fix Settingsedit view
  • Loading branch information
softwarecrash authored Aug 30, 2023
2 parents 0123549 + 0a06ad5 commit 5b564e6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ framework = arduino
monitor_speed = 115200
monitor_filters = esp8266_exception_decoder, default, time, printable, colorize

custom_prog_version = 2.0.0
custom_prog_version = 2.0.1

build_flags =
-DVERSION=${this.custom_prog_version}
Expand Down
6 changes: 3 additions & 3 deletions src/htmlProzessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ String htmlProcessor(const String &var)
{
extern Settings _settings;
if (var == F("pre_head_template"))
return (HTML_HEAD);
return (FPSTR(HTML_HEAD));
if (var == F("pre_foot_template"))
return (HTML_FOOT);
return (FPSTR(HTML_FOOT));
if (var == F("pre_software_version"))
return (SOFTWARE_VERSION);
if (var == F("pre_swversion"))
Expand All @@ -16,7 +16,7 @@ String htmlProcessor(const String &var)
return (String(ESP01).c_str());
if (var == F("pre_device_name"))
return (_settings.data.deviceName);
if (var == ("pre_device_quantity"))
if (var == F("pre_device_quantity"))
return (String(_settings.data.deviceQuantity).c_str());
if (var == F("pre_mqtt_server"))
return (_settings.data.mqttServer);
Expand Down
9 changes: 8 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bool restartNow = false;
bool workerCanRun = true;
unsigned long mqtttimer = 0;
unsigned long RestartTimer = 0;
unsigned long notifyTimer = 0;
byte ReqDevAddr = 1;
char mqtt_server[80];
char mqttClientId[80];
Expand Down Expand Up @@ -439,7 +440,13 @@ bool epWorker()
}
else
{
notifyClients(); // anyway, call the client something
if(errorcode != 0 && millis() > (notifyTimer +1000)){
notifyClients(); // anyway, call the client something
notifyTimer = millis();
} else if(errorcode == 0) {
notifyClients(); // anyway, call the client something
}

}

// mqtt part, when time is come, fire up the mqtt function to send all data to the broker
Expand Down
2 changes: 1 addition & 1 deletion src/webpages/HTML_CONFIRM_RESET.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%pre_head_template%
<figure class="text-center">
<h1>Erease all Data?</h1>
<h1>Erase all Data?</h1>
</figure>
<div class="d-grid gap-2">
<a class="btn btn-danger" href="/reset" role="button">Yes</a>
Expand Down
6 changes: 3 additions & 3 deletions src/webpages/HTML_MAIN.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ <h3 id="devicename"></h3>
</div>

<div class="row gx-0 mb-2 row gx-0 mb-2 bg-light rounded bg-opacity-50 px-2">
<div class="col"> Gemperature: </div>
<div class="col"> Temperature: </div>
<div class="col dF"><span id="deviceTemp"></span><span id="battTemp"></span></div>
</div>

<div class="row gx-0 mb-2 row gx-0 mb-2 bg-light rounded bg-opacity-50 px-2">
<div class="col"> Consumed Kwh: </div>
<div class="col"> Consumed kWh: </div>
<div class="col dF"><span id="consD"></span><span id="consM"></span><span id="consY"></span><span
id="consT"></span></div>
</div>

<div class="row gx-0 mb-2 row gx-0 mb-2 bg-light rounded bg-opacity-50 px-2">
<div class="col"> Generated Kwh: </div>
<div class="col"> Generated kWh: </div>
<div class="col dF"><span id="genD"></span><span id="genM"></span><span id="genY"></span><span
id="genT"></span></div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/webpages/HTML_SETTINGS_EDIT.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1>Edit Configuration</h1>
</figure>
<form method="POST" action="/settingssave" enctype="multipart/form-data">
<div class="input-group mb-3">
<div class="input-group mb-2">
<span class="input-group-text w-50" id="devicenamedesc">Device Name</span>
<input type="text" class="form-control" aria-describedby="devicenamedesc" id="devicename" name="post_deviceName"
maxlength="35" value="%pre_device_name%">
Expand Down Expand Up @@ -48,14 +48,14 @@ <h1>Edit Configuration</h1>
<input type="text" class="form-control" aria-describedby="mqtttrigerdesc" id="mqtttrigger" maxlength="80"
name="post_mqtttrigger" value="%pre_mqtt_mqtttrigger%">
</div>
<div class="input-group mb-3">
<div class="input-group mb-2">
<span class="input-group-text w-50" id="mqttjsondesc">MQTT Json Style</span>
<div class="form-switch form-control mqtt-settings-switch" style="width:50%%; text-align: center;">
<input type="checkbox" class="form-check-input form control" aria-describedby="mqttjsondesc" role="switch"
id="mqttjson" name="post_mqttjson" value="true" %pre_mqtt_json%>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group mb-2">
<span class="input-group-text w-50" id="webuicolormode">WebUI Dark Mode</span>
<div class="form-switch form-control" style="width:50%%; text-align: center;">
<input type="checkbox" class="form-check-input form control" aria-describedby="webuicolormode" role="switch"
Expand Down
2 changes: 1 addition & 1 deletion tools/mini_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def install(package):
for x in glob.glob(filePath+"*.html"):
print("prozessing file:" + Path(x).stem)
print(Path(x).stem)
cpp_output += "const char "+Path(x).stem+"[] PROGMEM = R\"rawliteral("
cpp_output += "static const char "+Path(x).stem+"[] PROGMEM = R\"rawliteral("
f = open(x, "r")
if env.GetProjectOption("build_type") == "debug":
cpp_output += f.read()
Expand Down

0 comments on commit 5b564e6

Please sign in to comment.