Add hardware detection

Add hardware detection to be overruled with SetOption51 (#6969)
This commit is contained in:
Theo Arends 2019-11-21 15:00:35 +01:00
parent 5f1074e3f6
commit b80708aef0
2 changed files with 23 additions and 7 deletions

View File

@ -4,6 +4,7 @@
* Add command TempOffset -12.6 .. 12.6 to set global temperature sensor offset (#6958) * Add command TempOffset -12.6 .. 12.6 to set global temperature sensor offset (#6958)
* Fix check deepsleep for valid values in Settings (#6961) * Fix check deepsleep for valid values in Settings (#6961)
* Fix Wifi instability when light is on, due to sleep=0 (#6961, #6608) * Fix Wifi instability when light is on, due to sleep=0 (#6961, #6608)
* Add hardware detection to be overruled with SetOption51 (#6969)
* *
* 7.0.0.4 20191108 * 7.0.0.4 20191108
* Add command WifiPower 0 .. 20.5 to set Wifi Output Power which will be default set to 17dBm * Add command WifiPower 0 .. 20.5 to set Wifi Output Power which will be default set to 17dBm

View File

@ -521,7 +521,7 @@ char* GetPowerDevice(char* dest, uint32_t idx, size_t size)
return GetPowerDevice(dest, idx, size, 0); return GetPowerDevice(dest, idx, size, 0);
} }
String GetDeviceHardware(void) bool IsEsp8285(void)
{ {
// esptool.py get_efuses // esptool.py get_efuses
uint32_t efuse1 = *(uint32_t*)(0x3FF00050); uint32_t efuse1 = *(uint32_t*)(0x3FF00050);
@ -529,10 +529,22 @@ String GetDeviceHardware(void)
// uint32_t efuse3 = *(uint32_t*)(0x3FF00058); // uint32_t efuse3 = *(uint32_t*)(0x3FF00058);
// uint32_t efuse4 = *(uint32_t*)(0x3FF0005C); // uint32_t efuse4 = *(uint32_t*)(0x3FF0005C);
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FUS: efuses 0x%08X 0x%08X, name %s"), efuse1, efuse2);
bool is_8285 = ( (efuse1 & (1 << 4)) || (efuse2 & (1 << 16)) ); bool is_8285 = ( (efuse1 & (1 << 4)) || (efuse2 & (1 << 16)) );
return String((is_8285) ? F("ESP8285") : F("ESP8266EX")); if (is_8285 && (ESP.getFlashChipRealSize() > 1048576)) {
is_8285 = false; // ESP8285 can only have 1M flash
}
return is_8285;
}
String GetDeviceHardware(void)
{
char buff[10];
if (IsEsp8285()) {
strcpy_P(buff, PSTR("ESP8285"));
} else {
strcpy_P(buff, PSTR("ESP8266EX"));
}
return String(buff);
} }
float ConvertTemp(float c) float ConvertTemp(float c)
@ -1027,9 +1039,12 @@ uint8_t ValidPin(uint32_t pin, uint32_t gpio)
if (FlashPin(pin)) { if (FlashPin(pin)) {
result = GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11 result = GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
} }
if ((WEMOS == Settings.module) && (!Settings.flag3.user_esp8285_enable)) { // SetOption51 - Enable ESP8285 user GPIO's if (!IsEsp8285() && !Settings.flag3.user_esp8285_enable) { // SetOption51 - Enable ESP8285 user GPIO's
if ((pin == 9) || (pin == 10)) { result = GPIO_NONE; } // Disable possible flash GPIO9 and GPIO10 if ((pin == 9) || (pin == 10)) {
result = GPIO_NONE; // Disable possible flash GPIO9 and GPIO10
} }
}
return result; return result;
} }