Skip to content

Commit

Permalink
Merge branch 'esp32-c3' of https://github.com/kscholty/ahoyDtu into k…
Browse files Browse the repository at this point in the history
…scholty-esp32-c3
  • Loading branch information
lumapu committed Dec 28, 2023
2 parents 4f75ce7 + e5176b7 commit d9f155a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 5 deletions.
15 changes: 15 additions & 0 deletions src/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ build_flags = ${env.build_flags}
monitor_filters =
esp32_exception_decoder

[env:esp32-c3-mini]
platform = [email protected]
board = lolin_c3_mini
build_flags = ${env.build_flags}
-DUSE_HSPI_FOR_EPD
-DDEF_NRF_CS_PIN=5
-DDEF_NRF_CE_PIN=0
-DDEF_NRF_IRQ_PIN=1
-DDEF_NRF_MISO_PIN=3
-DDEF_NRF_MOSI_PIN=4
-DDEF_NRF_SCLK_PIN=2
monitor_filters =
esp32_exception_decoder


[env:opendtufusion]
platform = [email protected]
board = esp32-s3-devkitc-1
Expand Down
53 changes: 48 additions & 5 deletions src/web/html/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,31 @@
[47, "GPIO47"],
[48, "GPIO48"],
];
var esp32c3pins = [
[255, "off / default"],
[0, "GPIO0"],
[1, "GPIO1"],
[2, "GPIO2"],
[3, "GPIO3"],
[4, "GPIO4"],
[5, "GPIO5"],
[6, "GPIO6"],
[7, "GPIO7"],
[8, "GPIO8"],
[9, "GPIO9"],
[10, "GPIO10"],
[11, "GPIO11"],
[12, "GPIO12 (PSRAM/FLASH)"],
[13, "GPIO13 (PSRAM/FLASH)"],
[14, "GPIO14 (PSRAM/FLASH)"],
[15, "GPIO15 (PSRAM/FLASH)"],
[16, "GPIO16 (PSRAM/FLASH)"],
[17, "GPIO17 (PSRAM/FLASH)"],
[18, "GPIO18 (DONT USE - USB-)"],
[19, "GPIO19 (DONT USE - USB+)"],
[20, "GPIO20 (RX)"],
[21, "GPIO21 (TX)"],
];
/*ENDIF_ESP32*/
var nrfPa = [
[0, "MIN (recommended)"],
Expand Down Expand Up @@ -872,13 +897,17 @@

function parsePinout(obj, type, system) {
var e = document.getElementById("pinout");
var pinList = esp32pins;
if("ESP8266" == type) pinList = esp8266pins;
else if ("ESP32-S3" == system["chip_model"]) pinList = esp32s3pins;
else if("ESP32-C3" == system["chip_model"]) pinList = esp32c3pins;
pins = [['led0', 'pinLed0', 'At least one inverter is producing'], ['led1', 'pinLed1', 'MqTT connected']];
for(p of pins) {
e.append(
ml("div", {class: "row mb-3"}, [
ml("div", {class: "col-12 col-sm-3 my-2"}, p[2]),
ml("div", {class: "col-12 col-sm-9"},
sel(p[1], ("ESP8266" == type) ? esp8266pins : ("ESP32-S3" == system["chip_model"]) ? esp32s3pins : esp32pins, obj[p[0]])
sel(p[1], pinList, obj[p[0]])
)
])
);
Expand All @@ -898,6 +927,11 @@
var en = inp("nrfEnable", null, null, ["cb"], "nrfEnable", "checkbox");
en.checked = obj["en"];

var pinList = esp32pins;
if("ESP8266" == type) pinList = esp8266pins;
else if ("ESP32-S3" == system["chip_model"]) pinList = esp32s3pins;
else if("ESP32-C3" == system["chip_model"]) pinList = esp32c3pins;

e.replaceChildren (
ml("div", {class: "row mb-3"}, [
ml("div", {class: "col-8 col-sm-3 my-2"}, "NRF24 Enable"),
Expand All @@ -915,7 +949,7 @@
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], ("ESP8266" == type) ? esp8266pins : ("ESP32-S3" == system["chip_model"]) ? esp32s3pins : esp32pins, objPin[p[0]])
sel(p[1], pinList, objPin[p[0]])
)
])
);
Expand All @@ -926,6 +960,10 @@
function parseCmtRadio(obj, type, system) {
var e = document.getElementById("cmt");
var en = inp("cmtEnable", null, null, ["cb"], "cmtEnable", "checkbox");
var pinList = esp32pins;
if ("ESP32-S3" == system["chip_model"]) pinList = esp32s3pins;
else if("ESP32-C3" == system["chip_model"]) pinList = esp32c3pins;

en.checked = obj["en"];

e.replaceChildren (
Expand All @@ -940,7 +978,7 @@
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], (("ESP32-S3" == system["chip_model"]) ? esp32s3pins : esp32pins), obj[p[0]])
sel(p[1], pinList, obj[p[0]])
)
])
);
Expand All @@ -954,6 +992,11 @@
}

function parseDisplay(obj, type, system) {
var pinList = esp32pins;
if("ESP8266" == type) pinList = esp8266pirpins;
else if ("ESP32-S3" == system["chip_model"]) pinList = esp32s3pins;
else if("ESP32-C3" == system["chip_model"]) pinList = esp32c3pins;

for(var i of ["disp_pwr"])
document.getElementsByName(i)[0].checked = obj[i];

Expand All @@ -968,7 +1011,7 @@
ml("div", {class: "row mb-3", id: "row_" + p[1]}, [
ml("div", {class: "col-12 col-sm-3 my-2"}, p[0].toUpperCase()),
ml("div", {class: "col-12 col-sm-9"},
sel(p[1], ("ESP8266" == type) ? esp8266pins : ("ESP32-S3" == system["chip_model"]) ? esp32s3pins : esp32pins, obj[p[1]])
sel(p[1], pinList, obj[p[1]])
)
])
);
Expand Down Expand Up @@ -1018,7 +1061,7 @@
document.getElementById("pirPin").append(
ml("div", {class: "row mb-3"}, [
ml("div", {class: "col-12 col-sm-3 my-2"}, "PIR sensor"),
ml("div", {class: "col-12 col-sm-9"}, sel("pir_pin", ("ESP8266" == type) ? esp8266pirpins : ("ESP32-S3" == system["chip_model"]) ? esp32s3pins : esp32pins, obj["pir_pin"]))
ml("div", {class: "col-12 col-sm-9"}, sel("pir_pin", pinList, obj["pir_pin"]))
])
);

Expand Down

0 comments on commit d9f155a

Please sign in to comment.