Ethernet modifications.
Added fixed Ethernet pins to cfg.json and settings page
This commit is contained in:
parent
63bb05b2d4
commit
849bdc52f6
@ -86,7 +86,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
|
|
||||||
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
|
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
|
||||||
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
|
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
|
||||||
//CJSON(strip.reverseMode, hw_led["rev"]);
|
|
||||||
CJSON(strip.rgbwMode, hw_led[F("rgbwm")]);
|
CJSON(strip.rgbwMode, hw_led[F("rgbwm")]);
|
||||||
|
|
||||||
JsonArray ins = hw_led["ins"];
|
JsonArray ins = hw_led["ins"];
|
||||||
@ -137,6 +136,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
// finalization done in beginStrip()
|
// finalization done in beginStrip()
|
||||||
}
|
}
|
||||||
if (lC > ledCount) ledCount = lC; // fix incorrect total length (honour analog setup)
|
if (lC > ledCount) ledCount = lC; // fix incorrect total length (honour analog setup)
|
||||||
|
if (hw_led["rev"]) busses.getBus(0)->reversed = true; //set 0.11 global reversed setting for first bus
|
||||||
|
|
||||||
// read multiple button configuration
|
// read multiple button configuration
|
||||||
JsonObject btn_obj = hw["btn"];
|
JsonObject btn_obj = hw["btn"];
|
||||||
@ -519,6 +519,7 @@ void serializeConfig() {
|
|||||||
ethernet["type"] = ethernetType;
|
ethernet["type"] = ethernetType;
|
||||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||||
JsonArray pins = ethernet.createNestedArray("pin");
|
JsonArray pins = ethernet.createNestedArray("pin");
|
||||||
|
for (uint8_t p=0; p<WLED_ETH_RSVD_PINS_COUNT; p++) pins.add(esp32_nonconfigurable_ethernet_pins[p].pin);
|
||||||
if (ethernetBoards[ethernetType].eth_power>=0) pins.add(ethernetBoards[ethernetType].eth_power);
|
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_mdc>=0) pins.add(ethernetBoards[ethernetType].eth_mdc);
|
||||||
if (ethernetBoards[ethernetType].eth_mdio>=0) pins.add(ethernetBoards[ethernetType].eth_mdio);
|
if (ethernetBoards[ethernetType].eth_mdio>=0) pins.add(ethernetBoards[ethernetType].eth_mdio);
|
||||||
|
@ -8,16 +8,20 @@
|
|||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Main WLED class implementation. Mostly initialization and connection logic
|
|
||||||
*/
|
|
||||||
|
|
||||||
WLED::WLED()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WLED_USE_ETHERNET
|
#ifdef WLED_USE_ETHERNET
|
||||||
ethernet_settings ethernetBoards[] = {
|
// The following six pins are neither configurable nor
|
||||||
|
// can they be re-assigned through IOMUX / GPIO matrix.
|
||||||
|
// See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit-v1.1.html#ip101gri-phy-interface
|
||||||
|
const managed_pin_type esp32_nonconfigurable_ethernet_pins[WLED_ETH_RSVD_PINS_COUNT] = {
|
||||||
|
{ 21, true }, // RMII EMAC TX EN == When high, clocks the data on TXD0 and TXD1 to transmitter
|
||||||
|
{ 19, true }, // RMII EMAC TXD0 == First bit of transmitted data
|
||||||
|
{ 22, true }, // RMII EMAC TXD1 == Second bit of transmitted data
|
||||||
|
{ 25, false }, // RMII EMAC RXD0 == First bit of received data
|
||||||
|
{ 26, false }, // RMII EMAC RXD1 == Second bit of received data
|
||||||
|
{ 27, true }, // RMII EMAC CRS_DV == Carrier Sense and RX Data Valid
|
||||||
|
};
|
||||||
|
|
||||||
|
const ethernet_settings ethernetBoards[] = {
|
||||||
// None
|
// None
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
@ -88,6 +92,14 @@ ethernet_settings ethernetBoards[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main WLED class implementation. Mostly initialization and connection logic
|
||||||
|
*/
|
||||||
|
|
||||||
|
WLED::WLED()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// turns all LEDs off and restarts ESP
|
// turns all LEDs off and restarts ESP
|
||||||
void WLED::reset()
|
void WLED::reset()
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2108261
|
#define VERSION 2108271
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
@ -1,20 +1,9 @@
|
|||||||
#ifndef WLED_ETHERNET_H
|
#ifndef WLED_ETHERNET_H
|
||||||
#define WLED_ETHERNET_H
|
#define WLED_ETHERNET_H
|
||||||
|
|
||||||
#ifdef WLED_USE_ETHERNET
|
|
||||||
#include "pin_manager.h"
|
#include "pin_manager.h"
|
||||||
|
|
||||||
// The following six pins are neither configurable nor
|
#ifdef WLED_USE_ETHERNET
|
||||||
// can they be re-assigned through IOMUX / GPIO matrix.
|
|
||||||
// See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit-v1.1.html#ip101gri-phy-interface
|
|
||||||
const managed_pin_type esp32_nonconfigurable_ethernet_pins[6] = {
|
|
||||||
{ 21, true }, // RMII EMAC TX EN == When high, clocks the data on TXD0 and TXD1 to transmitter
|
|
||||||
{ 19, true }, // RMII EMAC TXD0 == First bit of transmitted data
|
|
||||||
{ 22, true }, // RMII EMAC TXD1 == Second bit of transmitted data
|
|
||||||
{ 25, false }, // RMII EMAC RXD0 == First bit of received data
|
|
||||||
{ 26, false }, // RMII EMAC RXD1 == Second bit of received data
|
|
||||||
{ 27, true }, // RMII EMAC CRS_DV == Carrier Sense and RX Data Valid
|
|
||||||
};
|
|
||||||
|
|
||||||
// For ESP32, the remaining five pins are at least somewhat configurable.
|
// For ESP32, the remaining five pins are at least somewhat configurable.
|
||||||
// eth_address is in range [0..31], indicates which PHY (MAC?) address should be allocated to the interface
|
// eth_address is in range [0..31], indicates which PHY (MAC?) address should be allocated to the interface
|
||||||
@ -37,7 +26,10 @@ typedef struct EthernetSettings {
|
|||||||
eth_clock_mode_t eth_clk_mode;
|
eth_clock_mode_t eth_clk_mode;
|
||||||
} ethernet_settings;
|
} ethernet_settings;
|
||||||
|
|
||||||
extern ethernet_settings ethernetBoards[];
|
extern const ethernet_settings ethernetBoards[];
|
||||||
|
|
||||||
|
#define WLED_ETH_RSVD_PINS_COUNT 6
|
||||||
|
extern const managed_pin_type esp32_nonconfigurable_ethernet_pins[WLED_ETH_RSVD_PINS_COUNT];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -266,9 +266,8 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE/2);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE/2);
|
||||||
JsonObject mods = doc.createNestedObject(F("um"));
|
JsonObject mods = doc.createNestedObject(F("um"));
|
||||||
usermods.addToConfig(mods);
|
usermods.addToConfig(mods);
|
||||||
oappend(SET_F("d.um_p=["));
|
oappend(SET_F("d.um_p=[6,7,8,9,10,11"));
|
||||||
if (!mods.isNull()) {
|
if (!mods.isNull()) {
|
||||||
uint8_t i=0;
|
|
||||||
for (JsonPair kv : mods) {
|
for (JsonPair kv : mods) {
|
||||||
if (!kv.value().isNull()) {
|
if (!kv.value().isNull()) {
|
||||||
// element is an JsonObject
|
// element is an JsonObject
|
||||||
@ -277,22 +276,14 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
if (obj["pin"].is<JsonArray>()) {
|
if (obj["pin"].is<JsonArray>()) {
|
||||||
JsonArray pins = obj["pin"].as<JsonArray>();
|
JsonArray pins = obj["pin"].as<JsonArray>();
|
||||||
for (JsonVariant pv : pins) {
|
for (JsonVariant pv : pins) {
|
||||||
if (pv.as<int>() > -1) {
|
if (pv.as<int>() > -1) { oappend(","); oappendi(pv.as<int>()); }
|
||||||
if (i++) oappend(SET_F(","));
|
|
||||||
oappendi(pv.as<int>());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (obj["pin"].as<int>() > -1) {
|
if (obj["pin"].as<int>() > -1) { oappend(","); oappendi(obj["pin"].as<int>()); }
|
||||||
if (i++) oappend(SET_F(","));
|
|
||||||
oappendi(obj["pin"].as<int>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (i) oappend(SET_F(","));
|
|
||||||
oappend(SET_F("6,7,8,9,10,11")); // flash memory pins
|
|
||||||
#ifdef WLED_ENABLE_DMX
|
#ifdef WLED_ENABLE_DMX
|
||||||
oappend(SET_F(",2")); // DMX hardcoded pin
|
oappend(SET_F(",2")); // DMX hardcoded pin
|
||||||
#endif
|
#endif
|
||||||
@ -324,6 +315,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef WLED_USE_ETHERNET
|
#ifdef WLED_USE_ETHERNET
|
||||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||||
|
for (uint8_t p=0; p<WLED_ETH_RSVD_PINS_COUNT; p++) { oappend(","); oappend(itoa(esp32_nonconfigurable_ethernet_pins[p].pin,nS,10)); }
|
||||||
if (ethernetBoards[ethernetType].eth_power>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_power,nS,10)); }
|
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_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)); }
|
if (ethernetBoards[ethernetType].eth_mdio>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdio,nS,10)); }
|
||||||
|
Loading…
Reference in New Issue
Block a user