Merge branch 'master' into dev
This commit is contained in:
@@ -270,6 +270,18 @@ void WLED::loop()
|
||||
if (busConfigs[i] == nullptr) break;
|
||||
mem += BusManager::memUsage(*busConfigs[i]);
|
||||
if (mem <= MAX_LED_MEMORY) busses.add(*busConfigs[i]);
|
||||
/*
|
||||
if (busConfigs[i]->adjustBounds(ledCount)) {
|
||||
mem += busses.memUsage(*busConfigs[i]);
|
||||
if (mem <= MAX_LED_MEMORY) {
|
||||
busses.add(*busConfigs[i]);
|
||||
//RGBW mode is enabled if at least one of the strips is RGBW
|
||||
strip.isRgbw = (strip.isRgbw || BusManager::isRgbw(busConfigs[i]->type));
|
||||
//refresh is required to remain off if at least one of the strips requires the refresh.
|
||||
strip.isOffRefreshRequred |= BusManager::isOffRefreshRequred(busConfigs[i]->type);
|
||||
}
|
||||
}
|
||||
*/
|
||||
delete busConfigs[i]; busConfigs[i] = nullptr;
|
||||
}
|
||||
strip.finalizeInit();
|
||||
@@ -354,6 +366,8 @@ void WLED::setup()
|
||||
pinManager.allocatePin(2);
|
||||
#endif
|
||||
|
||||
for (uint8_t i=1; i<WLED_MAX_BUTTONS; i++) btnPin[i] = -1;
|
||||
|
||||
bool fsinit = false;
|
||||
DEBUGFS_PRINTLN(F("Mount FS"));
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
@@ -450,9 +464,9 @@ void WLED::beginStrip()
|
||||
briLast = briS; bri = 0;
|
||||
}
|
||||
if (bootPreset > 0) {
|
||||
applyPreset(bootPreset);
|
||||
applyPreset(bootPreset, CALL_MODE_INIT);
|
||||
}
|
||||
colorUpdated(NOTIFIER_CALL_MODE_INIT);
|
||||
colorUpdated(CALL_MODE_INIT);
|
||||
|
||||
// init relay pin
|
||||
if (rlyPin>=0)
|
||||
@@ -504,14 +518,60 @@ void WLED::initConnection()
|
||||
// Only initialize ethernet board if not NONE
|
||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||
ethernet_settings es = ethernetBoards[ethernetType];
|
||||
ETH.begin(
|
||||
(uint8_t) es.eth_address,
|
||||
(int) es.eth_power,
|
||||
(int) es.eth_mdc,
|
||||
(int) es.eth_mdio,
|
||||
(eth_phy_type_t) es.eth_type,
|
||||
(eth_clock_mode_t) es.eth_clk_mode
|
||||
);
|
||||
// Use PinManager to ensure pins are available for
|
||||
// ethernet AND to prevent other uses of these pins.
|
||||
bool s = true;
|
||||
byte pinsAllocated[4] { 255, 255, 255, 255 };
|
||||
|
||||
if (s && (s = pinManager.allocatePin((byte)es.eth_power))) {
|
||||
pinsAllocated[0] = (byte)es.eth_power;
|
||||
}
|
||||
if (s && (s = pinManager.allocatePin((byte)es.eth_mdc))) {
|
||||
pinsAllocated[1] = (byte)es.eth_mdc;
|
||||
}
|
||||
if (s && (s = pinManager.allocatePin((byte)es.eth_mdio))) {
|
||||
pinsAllocated[2] = (byte)es.eth_mdio;
|
||||
}
|
||||
switch(es.eth_clk_mode) {
|
||||
case ETH_CLOCK_GPIO0_IN:
|
||||
s = pinManager.allocatePin(0, false);
|
||||
pinsAllocated[3] = 0;
|
||||
break;
|
||||
case ETH_CLOCK_GPIO0_OUT:
|
||||
s = pinManager.allocatePin(0);
|
||||
pinsAllocated[3] = 0;
|
||||
break;
|
||||
case ETH_CLOCK_GPIO16_OUT:
|
||||
s = pinManager.allocatePin(16);
|
||||
pinsAllocated[3] = 16;
|
||||
break;
|
||||
case ETH_CLOCK_GPIO17_OUT:
|
||||
s = pinManager.allocatePin(17);
|
||||
pinsAllocated[3] = 17;
|
||||
break;
|
||||
default:
|
||||
s = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (s) {
|
||||
s = ETH.begin(
|
||||
(uint8_t) es.eth_address,
|
||||
(int) es.eth_power,
|
||||
(int) es.eth_mdc,
|
||||
(int) es.eth_mdio,
|
||||
(eth_phy_type_t) es.eth_type,
|
||||
(eth_clock_mode_t) es.eth_clk_mode
|
||||
);
|
||||
}
|
||||
|
||||
if (!s) {
|
||||
DEBUG_PRINTLN(F("Ethernet init failed"));
|
||||
// de-allocate only those pins allocated before the failure
|
||||
for (byte p : pinsAllocated) {
|
||||
pinManager.deallocatePin(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user