Added QuinLED-ESP32-Ethernet type

Set 19531 as default ESP32 PWM frequency
This commit is contained in:
cschwinne 2021-02-23 00:47:48 +01:00
parent 06f2f9adbb
commit 2c0b07387b
6 changed files with 32 additions and 13 deletions

View File

@ -193,7 +193,7 @@ class BusPwm : public Bus {
#ifdef ESP8266
analogWriteRange(255); //same range as one RGB channel
analogWriteFreq(WLED_PWM_FREQ_ESP8266);
analogWriteFreq(WLED_PWM_FREQ);
#else
_ledcStart = pinManager.allocateLedc(numPins);
if (_ledcStart == 255) { //no more free LEDC channels
@ -209,7 +209,7 @@ class BusPwm : public Bus {
#ifdef ESP8266
pinMode(_pins[i], OUTPUT);
#else
ledcSetup(_ledcStart + i, WLED_PWM_FREQ_ESP32, 8);
ledcSetup(_ledcStart + i, WLED_PWM_FREQ, 8);
ledcAttachPin(_pins[i], _ledcStart + i);
#endif
}

View File

@ -138,10 +138,13 @@
#define BTN_TYPE_SWITCH_ACT_HIGH 5 //not implemented
//Ethernet board types
#define WLED_NUM_ETH_TYPES 5
#define WLED_ETH_NONE 0
#define WLED_ETH_WT32_ETH01 1
#define WLED_ETH_ESP32_POE 2
#define WLED_ETH_WESP32 3
#define WLED_ETH_QUINLED 4
//Hue error codes
#define HUE_ERROR_INACTIVE 0
@ -201,9 +204,13 @@
#define ABL_MILLIAMPS_DEFAULT 850 // auto lower brightness to stay close to milliampere limit
// PWM settings
#define WLED_PWM_FREQ_ESP8266 880 //PWM frequency proven as good for LEDs
#define WLED_PWM_FREQ_ESP32 5000
#ifndef WLED_PWM_FREQ
#ifdef ESP8266
#define WLED_PWM_FREQ 880 //PWM frequency proven as good for LEDs
#else
#define WLED_PWM_FREQ 19531
#endif
#endif
#define TOUCH_THRESHOLD 32 // limit to recognize a touch, higher value means more sensitive

View File

@ -68,9 +68,11 @@
<h3>Ethernet Type</h3>
<select name="ETH">
<option value="0">None</option>
<option value="2">ESP32-POE</option>
<option value="4">QuinLED-ESP32</option>
<option value="3">WESP32</option>
<option value="1">WT32-ETH01</option>
<option value="2">ESP32-POE</option>
<option value="3">WESP32</option></select><br><br></div>
</select><br><br></div>
<hr>
<button type="button" onclick="B()">Back</button><button type="submit">Save & Connect</button>
</form>

View File

@ -63,10 +63,10 @@ Disable WiFi sleep: <input type="checkbox" name="WS"><br><i>
Can help with connectivity issues.<br>
Do not enable if WiFi is working correctly, increases power consumption.</i><div
id="ethd"><h3>Ethernet Type</h3><select name="ETH"><option value="0">None
</option><option value="1">WT32-ETH01</option><option value="2">ESP32-POE
</option><option value="3">WESP32</option></select><br><br></div><hr><button
type="button" onclick="B()">Back</button><button type="submit">Save & Connect
</button></form></body></html>)=====";
</option><option value="2">ESP32-POE</option><option value="4">QuinLED-ESP32
</option><option value="3">WESP32</option><option value="1">WT32-ETH01</option>
</select><br><br></div><hr><button type="button" onclick="B()">Back</button>
<button type="submit">Save & Connect</button></form></body></html>)=====";
// Autogenerated from wled00/data/settings_leds.htm, do not edit!!

View File

@ -58,6 +58,16 @@ ethernet_settings ethernetBoards[] = {
17, // eth_mdio,
ETH_PHY_LAN8720, // eth_type,
ETH_CLOCK_GPIO0_IN // eth_clk_mode
},
// QuinLed-ESP32-Ethernet
{
0, // eth_address,
5, // eth_power,
23, // eth_mdc,
18, // eth_mdio,
ETH_PHY_LAN8720, // eth_type, (confirm this is right?)
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
}
};
@ -439,7 +449,7 @@ void WLED::initConnection()
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
// Only initialize ethernet board if not NONE
if (ethernetType != WLED_ETH_NONE) {
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
ethernet_settings es = ethernetBoards[ethernetType];
ETH.begin(
(uint8_t) es.eth_address,

View File

@ -220,7 +220,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('c',SET_F("WS"),noWifiSleep);
#ifdef WLED_USE_ETHERNET
sappend('i',SET_F("ETH"),ethernetType);
sappend('v',SET_F("ETH"),ethernetType);
#else
//hide ethernet setting if not compiled in
oappend(SET_F("document.getElementById('ethd').style.display='none';"));