mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 01:48:19 +02:00
* made ethernet pinout configurable
* combined common network functions into class * seperated wifi station from AP mode
This commit is contained in:
parent
4fc61dc01f
commit
a44a5833ca
12 changed files with 540 additions and 25 deletions
|
@ -245,7 +245,7 @@
|
|||
<p class="des">{#MQTT_NOTE}</p>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-sm-3 my-2">{#INTERVAL}</div>
|
||||
<div class="col-12 col-sm-9"><input type="number" name="mqttInterval" title="Invalid input" /></div>
|
||||
<div class="col-12 col-sm-9"><input tyCMT2300Ape="number" name="mqttInterval" title="Invalid input" /></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-sm-3 my-2">Discovery Config (homeassistant)</div>
|
||||
|
@ -270,6 +270,10 @@
|
|||
<p class="des">{#RADIO} (CMT2300A)</p>
|
||||
<div id="cmt"></div>
|
||||
<!--ENDIF_ESP32-->
|
||||
<!--IF_ETHERNET-->
|
||||
<p class="des">Ethernet</p>
|
||||
<div id="eth"></div>
|
||||
<!--ENDIF_ETHERNET-->
|
||||
</fieldset>
|
||||
</div>
|
||||
<!--IF_PLUGIN_DISPLAY-->
|
||||
|
@ -986,7 +990,7 @@
|
|||
)
|
||||
}
|
||||
|
||||
function parseNrfRadio(obj, objPin, type, system) {
|
||||
function parseNrfRadio(obj, objPin) {
|
||||
var e = document.getElementById("rf24");
|
||||
var en = inp("nrfEnable", null, null, ["cb"], "nrfEnable", "checkbox");
|
||||
en.checked = obj["en"];
|
||||
|
@ -1013,11 +1017,11 @@
|
|||
])
|
||||
);
|
||||
|
||||
if ("ESP8266" == type) {
|
||||
pins = [['cs', 'pinCs'], ['ce', 'pinCe'], ['irq', 'pinIrq']];
|
||||
} else {
|
||||
pins = [['cs', 'pinCs'], ['ce', 'pinCe'], ['irq', 'pinIrq'], ['sclk', 'pinSclk'], ['mosi', 'pinMosi'], ['miso', 'pinMiso']];
|
||||
}
|
||||
/*IF_ESP32*/
|
||||
var pins = [['cs', 'pinCs'], ['ce', 'pinCe'], ['irq', 'pinIrq'], ['sclk', 'pinSclk'], ['mosi', 'pinMosi'], ['miso', 'pinMiso']];
|
||||
/*ELSE*/
|
||||
var pins = [['cs', 'pinCs'], ['ce', 'pinCe'], ['irq', 'pinIrq']];
|
||||
/*ENDIF_ESP32*/
|
||||
for(p of pins) {
|
||||
e.append(
|
||||
ml("div", {class: "row mb-3"}, [
|
||||
|
@ -1031,7 +1035,7 @@
|
|||
}
|
||||
|
||||
/*IF_ESP32*/
|
||||
function parseCmtRadio(obj, type, system) {
|
||||
function parseCmtRadio(obj) {
|
||||
var e = document.getElementById("cmt");
|
||||
var en = inp("cmtEnable", null, null, ["cb"], "cmtEnable", "checkbox");
|
||||
var pinList = esp32pins;
|
||||
|
@ -1046,7 +1050,6 @@
|
|||
/*ENDIF_ESP32-C3*/
|
||||
|
||||
en.checked = obj["en"];
|
||||
|
||||
e.replaceChildren (
|
||||
ml("div", {class: "row mb-3"}, [
|
||||
ml("div", {class: "col-8 col-sm-3 my-2"}, "{#CMT_ENABLE}"),
|
||||
|
@ -1073,6 +1076,42 @@
|
|||
}
|
||||
/*ENDIF_ESP32*/
|
||||
|
||||
/*IF_ETHERNET*/
|
||||
function parseEth(obj) {
|
||||
var e = document.getElementById("eth");
|
||||
var en = inp("ethEn", null, null, ["cb"], "ethEn", "checkbox");
|
||||
var pinList = esp32pins;
|
||||
/*IF_ESP32-S2*/
|
||||
pinList = esp32sXpins;
|
||||
/*ENDIF_ESP32-S2*/
|
||||
/*IF_ESP32-S3*/
|
||||
pinList = esp32sXpins;
|
||||
/*ENDIF_ESP32-S3*/
|
||||
/*IF_ESP32-C3*/
|
||||
pinList = esp32c3pins;
|
||||
/*ENDIF_ESP32-C3*/
|
||||
|
||||
en.checked = obj["en"];
|
||||
e.replaceChildren (
|
||||
ml("div", {class: "row mb-3"}, [
|
||||
ml("div", {class: "col-8 col-sm-3 my-2"}, "{#ETH_ENABLE}"),
|
||||
ml("div", {class: "col-4 col-sm-9"}, en)
|
||||
])
|
||||
);
|
||||
pins = [['cs', 'ethCs'], ['sclk', 'ethSclk'], ['miso', 'ethMiso'], ['mosi', 'ethMosi'], ['irq', 'ethIrq'], ['reset', 'ethRst']];
|
||||
for(p of pins) {
|
||||
e.append(
|
||||
ml("div", {class: "row mb-3"}, [
|
||||
ml("div", {class: "col-12 col-sm-3 my-2"}, p[0].toUpperCase()),
|
||||
ml("div", {class: "col-12 col-sm-9"},
|
||||
sel(p[1], pinList, obj[p[0]])
|
||||
)
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
/*ENDIF_ETHERNET*/
|
||||
|
||||
function parseSerial(obj) {
|
||||
var e = document.getElementById("serialCb")
|
||||
var l = [["serEn", "show_live_data", "{#LOG_PRINT_INVERTER_DATA}"], ["serDbg", "debug", "{#LOG_SERIAL_DEBUG}"], ["priv", "priv", "{#LOG_PRIVACY_MODE}"], ["wholeTrace", "wholeTrace", "{#LOG_PRINT_TRACES}"], ["log2mqtt", "log2mqtt", "{#LOG_TO_MQTT}"]]
|
||||
|
@ -1253,10 +1292,13 @@
|
|||
parseNtp(root["ntp"]);
|
||||
parseSun(root["sun"]);
|
||||
parsePinout(root["pinout"], root["system"]["esp_type"], root["system"]);
|
||||
parseNrfRadio(root["radioNrf"], root["pinout"], root["system"]["esp_type"], root["system"]);
|
||||
parseNrfRadio(root["radioNrf"], root["pinout"]);
|
||||
/*IF_ESP32*/
|
||||
parseCmtRadio(root["radioCmt"], root["system"]["esp_type"], root["system"]);
|
||||
parseCmtRadio(root["radioCmt"]);
|
||||
/*ENDIF_ESP32*/
|
||||
/*IF_ETHERNET*/
|
||||
parseEth(root.system.eth)
|
||||
/*ENDIF_ETHERNET*/
|
||||
parseSerial(root["serial"]);
|
||||
/*IF_PLUGIN_DISPLAY*/
|
||||
parseDisplay(root["display"], root["system"]["esp_type"], root["system"]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue