Skip to content

Commit

Permalink
Version 2.7.3
Browse files Browse the repository at this point in the history
Changes since 2.7.2

fix: Cannot switch off AP mode #233
fix: value 0 not displayed correctly in web ui input fields

Firmware binary (CVE HW rev.2 and NON-CVE):
https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.3.bin
  • Loading branch information
arjenhiemstra committed Feb 20, 2024
1 parent 7fa8224 commit 2656626
Show file tree
Hide file tree
Showing 12 changed files with 759 additions and 748 deletions.
16 changes: 8 additions & 8 deletions compiled_firmware_files/firmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/hardware_rev_1/nrgitho-hw1-v2.2.4.bin"
},
"2": {
"latest_fw": "2.7.2",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.2.bin",
"latest_beta_fw": "2.7.2",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.2.bin"
"latest_fw": "2.7.3",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.3.bin",
"latest_beta_fw": "2.7.3",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.3.bin"
},
"NON-CVE 1": {
"latest_fw": "2.7.2",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.2.bin",
"latest_beta_fw": "2.7.2",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.2.bin"
"latest_fw": "2.7.3",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.3.bin",
"latest_beta_fw": "2.7.3",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.3.bin"
}
}
}
Binary file not shown.
Binary file not shown.
20 changes: 14 additions & 6 deletions software/NRG_itho_wifi/main/tasks/task_syscontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,14 @@ void init_i2c_functions()

void wifiInit()
{
WiFi.onEvent(WiFiEvent);

setupWiFigeneric();

if (!loadWifiConfig("flash"))
{
E_LOG("Setup: Wifi config load failed");
}

WiFi.onEvent(WiFiEvent);
setupWiFigeneric();

if (wifiConfig.aptimeout > 0)
{
I_LOG("Setup: starting wifi access point");
Expand Down Expand Up @@ -787,8 +787,16 @@ void setupWiFigeneric()
// Begin init of actual wifi connection

// Set correct mode
if (!WiFi.mode(WIFI_AP_STA))
E_LOG("Unable to set WiFi mode");
if (wifiConfig.aptimeout > 0)
{
if (WiFi.mode(WIFI_AP_STA))
I_LOG("WiFi mode WIFI_AP_STA");
}
else
{
if (WiFi.mode(WIFI_STA))
I_LOG("WiFi mode WIFI_STA");
}

esp_err_t esp_wifi_set_max_tx_power(int8_t power);
esp_err_t wifi_set_max_tx_power = esp_wifi_set_max_tx_power(78);
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#pragma once

#define FWVERSION "2.7.2"
#define FWVERSION "2.7.3"
1,381 changes: 690 additions & 691 deletions software/NRG_itho_wifi/main/webroot/controls_js_gz.h

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions software/NRG_itho_wifi/main/webroot_source/controls.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//This file is automatically generated - do not edit this file, edit the files in dir controls_js_sources instead and run the build

var debug = false;
var count = 0;
var itho_low = 0;
var itho_medium = 127;
var itho_high = 255;
var sensor = -1;
var uuid = 0;
var wifistat_to;
var statustimer_to;

localStorage.setItem("statustimer", 0);
localStorage.setItem("wifistat", 0);
Expand Down Expand Up @@ -68,7 +71,9 @@ function processMessage(message) {
} catch (error) {
f = JSON.parse(message);
}
//console.log(f);
if (debug) {
console.log(f);
}
let g = document.body;
if (f.wifisettings) {
let x = f.wifisettings;
Expand Down Expand Up @@ -345,7 +350,7 @@ function updateSettingsLocStor(receivedData) {
function loadSettingsLocStor() {

let setlen = localStorage.getItem("itho_setlen");
if (typeof setlen == 'undefined' || setlen == null) {
if (typeof setlen === 'undefined' || setlen == null) {
console.log("error: loadSettingsLocStor setting length unavailable");
return;
}
Expand Down Expand Up @@ -807,7 +812,9 @@ $(document).ready(function () {

function websock_send(message) {
websock.send(message);
//console.log(message);
if (debug) {
console.log(message);
}
}

var timerHandle = setTimeout(function () {
Expand All @@ -833,12 +840,12 @@ function processElements(x) {
}
var el = $(`#${key}`);
if (el.is('input') || el.is('select')) {
if ($(`#${key}`).val() != x[key]) {
if ($(`#${key}`).val() !== x[key]) {
$(`#${key}`).val(x[key]);
}
}
else if (el.is('span')) {
if ($(`#${key}`).text() != x[key]) {
if ($(`#${key}`).text() !== x[key]) {
$(`#${key}`).text(x[key]);
}
}
Expand All @@ -856,7 +863,7 @@ function processElements(x) {
}
var elbyname = $(`[name='${key}']`).each(function () {
if ($(this).is('span')) {
if ($(this).text() != x[key]) {
if ($(this).text() !== x[key]) {
$(this).text(x[key]);
}
}
Expand Down Expand Up @@ -988,13 +995,16 @@ function resetPage() {
}
function tick() {
var timeDisplay = document.getElementById('time');
if (timeDisplay == null)
return;
var sec = secondsRemaining - (Math.floor(secondsRemaining / 60) * 60);
if (sec < 10) sec = '0' + sec;
var message = `This page will reload to the start page in ${sec} seconds...`;
timeDisplay.innerHTML = message;
if (secondsRemaining === 0) {
clearInterval(intervalHandle);
resetPage();
return;
}
secondsRemaining--;
}
Expand All @@ -1021,12 +1031,8 @@ function updateSlider(value) {
var lastPageReq = "";
function update_page(page) {
lastPageReq = page;
if (page != 'status') {
localStorage.setItem("statustimer", 0);
}
if (page != 'wifisetup') {
localStorage.setItem("wifistat", 0);
}
clearTimeout(wifistat_to);
clearTimeout(statustimer_to);
$('#main').empty();
$('#main').css('max-width', '768px')
if (page == 'index') { $('#main').append(html_index); }
Expand Down Expand Up @@ -2071,11 +2077,9 @@ var html_ithostatus = `
</form>
<script>
$(document).ready(function () {
localStorage.setItem("statustimer", 1);
function repeat() {
if (localStorage.getItem("statustimer") != 1) return;
getSettings('ithostatus');
setTimeout(repeat, 5000);
ithostatus_to = setTimeout(repeat, 5000);
}
repeat();
});
Expand Down Expand Up @@ -2286,11 +2290,9 @@ var html_wifisetup = `
}
$(document).ready(function () {
getSettings('wifisetup');
localStorage.setItem("wifistat", 1);
function repeat_wifistat() {
if (localStorage.getItem("wifistat") != 1) return;
getSettings('wifistat');
setTimeout(repeat_wifistat, 1000);
wifistat_to = setTimeout(repeat_wifistat, 1000);
}
repeat_wifistat();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ <h1>Itho status</h1>
</form>
<script>
$(document).ready(function () {
localStorage.setItem("statustimer", 1);
function repeat() {
if (localStorage.getItem("statustimer") != 1) return;
getSettings('ithostatus');
setTimeout(repeat, 5000);
ithostatus_to = setTimeout(repeat, 5000);
}
repeat();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,9 @@ <h1>Wifi setup</h1>
}
$(document).ready(function () {
getSettings('wifisetup');
localStorage.setItem("wifistat", 1);
function repeat_wifistat() {
if (localStorage.getItem("wifistat") != 1) return;
getSettings('wifistat');
setTimeout(repeat_wifistat, 1000);
wifistat_to = setTimeout(repeat_wifistat, 1000);
}
repeat_wifistat();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

var debug = false;
var count = 0;
var itho_low = 0;
var itho_medium = 127;
var itho_high = 255;
var sensor = -1;
var uuid = 0;
var wifistat_to;
var statustimer_to;

localStorage.setItem("statustimer", 0);
localStorage.setItem("wifistat", 0);
Expand Down Expand Up @@ -67,7 +70,9 @@ function processMessage(message) {
} catch (error) {
f = JSON.parse(message);
}
//console.log(f);
if (debug) {
console.log(f);
}
let g = document.body;
if (f.wifisettings) {
let x = f.wifisettings;
Expand Down Expand Up @@ -344,7 +349,7 @@ function updateSettingsLocStor(receivedData) {
function loadSettingsLocStor() {

let setlen = localStorage.getItem("itho_setlen");
if (typeof setlen == 'undefined' || setlen == null) {
if (typeof setlen === 'undefined' || setlen == null) {
console.log("error: loadSettingsLocStor setting length unavailable");
return;
}
Expand Down Expand Up @@ -806,7 +811,9 @@ $(document).ready(function () {

function websock_send(message) {
websock.send(message);
//console.log(message);
if (debug) {
console.log(message);
}
}

var timerHandle = setTimeout(function () {
Expand All @@ -832,12 +839,12 @@ function processElements(x) {
}
var el = $(`#${key}`);
if (el.is('input') || el.is('select')) {
if ($(`#${key}`).val() != x[key]) {
if ($(`#${key}`).val() !== x[key]) {
$(`#${key}`).val(x[key]);
}
}
else if (el.is('span')) {
if ($(`#${key}`).text() != x[key]) {
if ($(`#${key}`).text() !== x[key]) {
$(`#${key}`).text(x[key]);
}
}
Expand All @@ -855,7 +862,7 @@ function processElements(x) {
}
var elbyname = $(`[name='${key}']`).each(function () {
if ($(this).is('span')) {
if ($(this).text() != x[key]) {
if ($(this).text() !== x[key]) {
$(this).text(x[key]);
}
}
Expand Down Expand Up @@ -987,13 +994,16 @@ function resetPage() {
}
function tick() {
var timeDisplay = document.getElementById('time');
if (timeDisplay == null)
return;
var sec = secondsRemaining - (Math.floor(secondsRemaining / 60) * 60);
if (sec < 10) sec = '0' + sec;
var message = `This page will reload to the start page in ${sec} seconds...`;
timeDisplay.innerHTML = message;
if (secondsRemaining === 0) {
clearInterval(intervalHandle);
resetPage();
return;
}
secondsRemaining--;
}
Expand All @@ -1020,12 +1030,8 @@ function updateSlider(value) {
var lastPageReq = "";
function update_page(page) {
lastPageReq = page;
if (page != 'status') {
localStorage.setItem("statustimer", 0);
}
if (page != 'wifisetup') {
localStorage.setItem("wifistat", 0);
}
clearTimeout(wifistat_to);
clearTimeout(statustimer_to);
$('#main').empty();
$('#main').css('max-width', '768px')
if (page == 'index') { $('#main').append(html_index); }
Expand Down
10 changes: 5 additions & 5 deletions software/NRG_itho_wifi/main/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void jsonWsSend(const char *rootName)
nested["dns1"] = WiFi.dnsIP().toString();
nested["dns2"] = WiFi.dnsIP(1).toString();
}
if (strcmp(wifiConfig.hostname, "") == 0) //defualt config still there
if (strcmp(wifiConfig.hostname, "") == 0) // defualt config still there
{
nested["hostname"] = hostName();
}
Expand All @@ -42,9 +42,9 @@ void jsonWsSend(const char *rootName)
long timeout = wifiConfig.aptimeout * 60 * 1000;
long time = (millis() - APmodeTimeout) < timeout ? (timeout - (millis() - APmodeTimeout)) / 1000 : 0;

if (wifiConfig.aptimeout == 0)
if (!wifiModeAP || wifiConfig.aptimeout == 0)
{
snprintf(apremain, sizeof(apremain), "%s", "always off");
snprintf(apremain, sizeof(apremain), "%s", "off");
}
else if (wifiConfig.aptimeout == 255)
{
Expand Down Expand Up @@ -328,8 +328,8 @@ static void wsEvent(struct mg_connection *c, int ev, void *ev_data, void *fn_dat
}
else if (val == 4030)
{
//setSetting4030(root["idx"].as<uint16_t>(), root["dt"].as<uint8_t>(), root["val"].as<int16_t>(), root["chk"].as<uint8_t>(), root["dryrun"].as<bool>(), true);
}
// setSetting4030(root["idx"].as<uint16_t>(), root["dt"].as<uint8_t>(), root["val"].as<int16_t>(), root["chk"].as<uint8_t>(), root["dryrun"].as<bool>(), true);
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ default_envs =
[env]
; Global data for all [env:***]
build_flags =
-D VERSION=2.7.2
-D VERSION=2.7.3
;upload_port = /dev/cu.usbserial-1410 #optional, only needed if PlatformIO autodetect is not working
;monitor_port = /dev/cu.usbserial-1410 #optional, only needed if PlatformIO autodetect is not working
framework = arduino, espidf
Expand Down

0 comments on commit 2656626

Please sign in to comment.