Browse Source

0.7.48

* fix SSD1309 2.42" display pinout
* improved setup page: save and delete of inverters
pull/1136/head
lumapu 1 year ago
parent
commit
e8fa9c747e
  1. 4
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 43
      src/web/html/setup.html

4
src/CHANGES.md

@ -1,5 +1,9 @@
# Development Changes # Development Changes
## 0.7.48 - 2023-09-10
* fix SSD1309 2.42" display pinout
* improved setup page: save and delete of inverters
## 0.7.47 - 2023-09-07 ## 0.7.47 - 2023-09-07
* fix boot loop #1140 * fix boot loop #1140
* fix regex in `setup` page * fix regex in `setup` page

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 7 #define VERSION_MINOR 7
#define VERSION_PATCH 47 #define VERSION_PATCH 48
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

43
src/web/html/setup.html

@ -343,7 +343,6 @@
</div> </div>
{#HTML_FOOTER} {#HTML_FOOTER}
<script type="text/javascript"> <script type="text/javascript">
var highestId = 0;
var maxInv = 0; var maxInv = 0;
var ts = 0; var ts = 0;
@ -470,9 +469,7 @@
} }
document.getElementById("btnAdd").addEventListener("click", function() { document.getElementById("btnAdd").addEventListener("click", function() {
if(highestId <= (maxInv-1)) { ivHtml(JSON.parse('{"enabled":true,"name":"","serial":"","channels":6,"ch_max_pwr":[0,0,0,0,0,0],"ch_name":["","","","","",""],"ch_yield_cor":[0,0,0,0,0,0]}'));
ivHtml(JSON.parse('{"enabled":true,"name":"","serial":"","channels":6,"ch_max_pwr":[0,0,0,0,0,0],"ch_name":["","","","","",""],"ch_yield_cor":[0,0,0,0,0,0]}'), highestId);
}
}); });
function apiCbWifi(obj) { function apiCbWifi(obj) {
@ -542,12 +539,8 @@
} }
function delIv() { function delIv() {
var id = this.id.substring(0,4); var id = this.id.substring(0, this.id.length-3);
var e = document.getElementsByName(id + "Addr")[0]; document.getElementById(id).remove();
e.value = "";
e.dispatchEvent(new Event("keyup"));
e.dispatchEvent(new Event("change"));
document.getElementsByName(id + "Name")[0].value = "";
} }
function mlCb(id, des, chk=false) { function mlCb(id, des, chk=false) {
@ -567,12 +560,25 @@
]); ]);
} }
function ivHtml(obj, id) { function getFreeId() {
highestId = id + 1; var id = 0;
if(highestId == maxInv) while(id < maxInv) {
if(null == document.getElementById("inv" + id))
return id;
id++;
}
return null;
}
function ivHtml(obj) {
var id = getFreeId();
if(null == id) {
setHide("btnAdd", true); setHide("btnAdd", true);
return;
}
var iv = document.getElementById("inverter"); var iv = ml("div", {id: "inv" + id}, null);
document.getElementById("inverter").appendChild(iv);
iv.appendChild(des("Inverter " + id)); iv.appendChild(des("Inverter " + id));
id = "inv" + id; id = "inv" + id;
@ -651,7 +657,7 @@
); );
} }
var del = inp(id+"del", "X", 0, ["btn", "btnDel"], id+"del", "button"); var del = ml("input", {class: "btn btnDel", type: "button", id: id+"del", value: "X"}, null);
del.addEventListener("click", delIv); del.addEventListener("click", delIv);
iv.append(mlE("Delete", del)); iv.append(mlE("Delete", del));
} }
@ -699,10 +705,10 @@
} }
function parseIv(obj) { function parseIv(obj) {
maxInv = obj["max_num_inverters"];
for(var i = 0; i < obj.inverter.length; i++) for(var i = 0; i < obj.inverter.length; i++)
ivHtml(obj.inverter[i], i); ivHtml(obj.inverter[i]);
ivGlob(obj); ivGlob(obj);
maxInv = obj["max_num_inverters"];
} }
function parseMqtt(obj) { function parseMqtt(obj) {
@ -881,7 +887,8 @@
[2, [1,1,0,0,0,0]], //SH1106_128X64 [2, [1,1,0,0,0,0]], //SH1106_128X64
[3, [1,1,1,1,0,0]], //PCD8544_84X48 /nokia5110 [3, [1,1,1,1,0,0]], //PCD8544_84X48 /nokia5110
[4, [1,1,0,0,0,0]], //SSD1306_128X32 [4, [1,1,0,0,0,0]], //SSD1306_128X32
[5, [1,1,0,0,0,0]], //SSD1306_64X48 [5, [1,1,0,0,0,0]], //SSD1306_128x64
[6, [1,1,0,0,0,0]], //SSD1309_128x64
[10, [1,1,1,1,1,1]] //ePaper [10, [1,1,1,1,1,1]] //ePaper
]) ])
for(var i = 0; i < pins.length; i++) { for(var i = 0; i < pins.length; i++) {

Loading…
Cancel
Save