ESP32 S2 fix for RMT channels.
Ethernet pins stored in cfg.json for usermod checks.
This commit is contained in:
parent
8c9fb956ff
commit
d28158bc74
@ -665,10 +665,11 @@ class PolyBus {
|
||||
uint8_t offset = 0; //0 = RMT (num 0-7) 8 = I2S0 9 = I2S1
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32S2
|
||||
if (num > 9) return I_NONE;
|
||||
#else
|
||||
if (num > 8) return I_NONE;
|
||||
#endif
|
||||
if (num > 7) offset = num -7;
|
||||
#else
|
||||
if (num > 5) return I_NONE;
|
||||
if (num > 4) offset = num -4;
|
||||
#endif
|
||||
switch (busType) {
|
||||
case TYPE_WS2812_RGB:
|
||||
case TYPE_WS2812_WWA:
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "wled.h"
|
||||
#include "wled_ethernet.h"
|
||||
|
||||
/*
|
||||
* Serializes and parses the cfg.json and wsec.json settings files, stored in internal FS.
|
||||
@ -56,6 +57,24 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
JsonObject ethernet = doc[F("eth")];
|
||||
CJSON(ethernetType, ethernet["type"]);
|
||||
// allocate ethernet pins
|
||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||
if (ethernetBoards[ethernetType].eth_power>=0) pinManager.allocatePin(ethernetBoards[ethernetType].eth_power);
|
||||
if (ethernetBoards[ethernetType].eth_mdc>=0) pinManager.allocatePin(ethernetBoards[ethernetType].eth_mdc);
|
||||
if (ethernetBoards[ethernetType].eth_mdio>=0) pinManager.allocatePin(ethernetBoards[ethernetType].eth_mdio);
|
||||
switch (ethernetBoards[ethernetType].eth_clk_mode) {
|
||||
case ETH_CLOCK_GPIO0_IN:
|
||||
case ETH_CLOCK_GPIO0_OUT:
|
||||
pinManager.allocatePin(0);
|
||||
break;
|
||||
case ETH_CLOCK_GPIO16_OUT:
|
||||
pinManager.allocatePin(16);
|
||||
break;
|
||||
case ETH_CLOCK_GPIO17_OUT:
|
||||
pinManager.allocatePin(17);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -484,6 +503,24 @@ void serializeConfig() {
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
JsonObject ethernet = doc.createNestedObject("eth");
|
||||
ethernet["type"] = ethernetType;
|
||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||
JsonArray pins = ethernet.createNestedArray("pin");
|
||||
if (ethernetBoards[ethernetType].eth_power>=0) pins.add(ethernetBoards[ethernetType].eth_power);
|
||||
if (ethernetBoards[ethernetType].eth_mdc>=0) pins.add(ethernetBoards[ethernetType].eth_mdc);
|
||||
if (ethernetBoards[ethernetType].eth_mdio>=0) pins.add(ethernetBoards[ethernetType].eth_mdio);
|
||||
switch (ethernetBoards[ethernetType].eth_clk_mode) {
|
||||
case ETH_CLOCK_GPIO0_IN:
|
||||
case ETH_CLOCK_GPIO0_OUT:
|
||||
pins.add(0);
|
||||
break;
|
||||
case ETH_CLOCK_GPIO16_OUT:
|
||||
pins.add(16);
|
||||
break;
|
||||
case ETH_CLOCK_GPIO17_OUT:
|
||||
pins.add(17);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
JsonObject hw = doc.createNestedObject("hw");
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2107061
|
||||
#define VERSION 2107071
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
@ -324,11 +324,10 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
#endif
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||
ethernet_settings es = ethernetBoards[ethernetType];
|
||||
if (es.eth_power>0) { oappend(","); oappend(itoa(es.eth_power,nS,10)); }
|
||||
if (es.eth_mdc>0) { oappend(","); oappend(itoa(es.eth_mdc,nS,10)); }
|
||||
if (es.eth_mdio>0) { oappend(","); oappend(itoa(es.eth_mdio,nS,10)); }
|
||||
switch (es.eth_clk_mode) {
|
||||
if (ethernetBoards[ethernetType].eth_power>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_power,nS,10)); }
|
||||
if (ethernetBoards[ethernetType].eth_mdc>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdc,nS,10)); }
|
||||
if (ethernetBoards[ethernetType].eth_mdio>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdio,nS,10)); }
|
||||
switch (ethernetBoards[ethernetType].eth_clk_mode) {
|
||||
case ETH_CLOCK_GPIO0_IN:
|
||||
case ETH_CLOCK_GPIO0_OUT:
|
||||
oappend(SET_F(",0"));
|
||||
|
Loading…
Reference in New Issue
Block a user