Browse Source

fix static IP #504

pull/518/head
lumapu 2 years ago
parent
commit
e1b6fe1344
  1. 3
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 6
      src/utils/helper.cpp
  4. 9
      src/web/html/serial.html

3
src/CHANGES.md

@ -1,5 +1,8 @@
# Changelog # Changelog
## 0.5.55
* fixed static IP save
## 0.5.54 ## 0.5.54
* changed sunrise / sunset calculation, angle is now `-3.5` instead of original `-0.83` * changed sunrise / sunset calculation, angle is now `-3.5` instead of original `-0.83`
* improved scheduler (removed -1 from `reload`) #483 * improved scheduler (removed -1 from `reload`) #483

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 5 #define VERSION_MINOR 5
#define VERSION_PATCH 54 #define VERSION_PATCH 55
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

6
src/utils/helper.cpp

@ -7,16 +7,16 @@
namespace ah { namespace ah {
void ip2Arr(uint8_t ip[], const char *ipStr) { void ip2Arr(uint8_t ip[], const char *ipStr) {
char tmp[16];
memset(ip, 0, 4); memset(ip, 0, 4);
char *tmp = new char[strlen(ipStr)+1]; memset(tmp, 0, 16);
snprintf(tmp, strlen(ipStr), ipStr); snprintf(tmp, 16, ipStr);
char *p = strtok(tmp, "."); char *p = strtok(tmp, ".");
uint8_t i = 0; uint8_t i = 0;
while(NULL != p) { while(NULL != p) {
ip[i++] = atoi(p); ip[i++] = atoi(p);
p = strtok(NULL, "."); p = strtok(NULL, ".");
} }
delete[] tmp;
} }
// note: char *str needs to be at least 16 bytes long // note: char *str needs to be at least 16 bytes long

9
src/web/html/serial.html

@ -56,7 +56,6 @@
<input type="button" value="Restart" class="btn" id="restart"/> <input type="button" value="Restart" class="btn" id="restart"/>
<input type="button" value="Turn Off" class="btn" id="power_off"/> <input type="button" value="Turn Off" class="btn" id="power_off"/>
<input type="button" value="Turn On" class="btn" id="power_on"/> <input type="button" value="Turn On" class="btn" id="power_on"/>
<input type="button" value="Alarm Info" class="btn" id="alarminfo"/>
</div> </div>
<br/> <br/>
<p>Ctrl result: <span id="result">n/a</span></p> <p>Ctrl result: <span id="result">n/a</span></p>
@ -186,14 +185,6 @@
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj));
}); });
document.getElementById("alarminfo").addEventListener("click", function() {
var obj = new Object();
obj.id = get_selected_iv();
obj.cmd = "dev";
obj.val = 0x11;
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj));
});
document.getElementById("sendpwrlim").addEventListener("click", function() { document.getElementById("sendpwrlim").addEventListener("click", function() {
var val = parseInt(document.getElementsByName('pwrlimval')[0].value); var val = parseInt(document.getElementsByName('pwrlimval')[0].value);
var cmd = document.getElementsByName('pwrlimctrl')[0].value; var cmd = document.getElementsByName('pwrlimctrl')[0].value;

Loading…
Cancel
Save