Restore hardware detection

This commit is contained in:
Theo Arends 2019-12-02 10:31:33 +01:00
parent 28e7668e6b
commit e150717e95
5 changed files with 35 additions and 9 deletions

View File

@ -49,7 +49,6 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
### Version 7.1.1.1 Betty
- Remove inconsistent hardware detection introduced in version 7.0.0.5
- Fix lost functionality of GPIO9 and GPIO10 on some devices (#7080)
- Fix Zigbee uses Hardware Serial if GPIO 1/3 or GPIO 13/15 and SerialLog 0 (#7071)
- Change light color schemes 2, 3 and 4 from color wheel to Hue driven

View File

@ -2,7 +2,6 @@
### 7.1.1.1 20191201
- Remove inconsistent hardware detection introduced in version 7.0.0.5
- Fix lost functionality of GPIO9 and GPIO10 on some devices (#7080)
- Fix Zigbee uses Hardware Serial if GPIO 1/3 or GPIO 13/15 and SerialLog 0 (#7071)
- Change light color schemes 2, 3 and 4 from color wheel to Hue driven

View File

@ -521,6 +521,31 @@ char* GetPowerDevice(char* dest, uint32_t idx, size_t size)
return GetPowerDevice(dest, idx, size, 0);
}
void GetEspHardwareType(void)
{
// esptool.py get_efuses
uint32_t efuse1 = *(uint32_t*)(0x3FF00050);
uint32_t efuse2 = *(uint32_t*)(0x3FF00054);
// uint32_t efuse3 = *(uint32_t*)(0x3FF00058);
// uint32_t efuse4 = *(uint32_t*)(0x3FF0005C);
is_8285 = ( (efuse1 & (1 << 4)) || (efuse2 & (1 << 16)) );
if (is_8285 && (ESP.getFlashChipRealSize() > 1048576)) {
is_8285 = false; // ESP8285 can only have 1M flash
}
}
String GetDeviceHardware(void)
{
char buff[10];
if (is_8285) {
strcpy_P(buff, PSTR("ESP8285"));
} else {
strcpy_P(buff, PSTR("ESP8266EX"));
}
return String(buff);
}
float ConvertTemp(float c)
{
float result = c;
@ -1008,18 +1033,18 @@ bool FlashPin(uint32_t pin)
uint8_t ValidPin(uint32_t pin, uint32_t gpio)
{
uint8_t result = gpio;
if (FlashPin(pin)) {
result = GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
}
// if (!is_8285 && !Settings.flag3.user_esp8285_enable) { // SetOption51 - Enable ESP8285 user GPIO's
if ((WEMOS == Settings.module) && !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
return GPIO_NONE; // Disable possible flash GPIO9 and GPIO10
}
}
return result;
return gpio;
}
bool ValidGPIO(uint32_t pin, uint32_t gpio)

View File

@ -376,9 +376,10 @@ void CmndStatus(void)
if ((0 == payload) || (2 == payload)) {
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\""
D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"}}"),
D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\","
"\"Hardware\":\"%s\"}}"),
my_version, my_image, GetBuildDateAndTime().c_str(),
ESP.getBootVersion(), ESP.getSdkVersion());
ESP.getBootVersion(), ESP.getSdkVersion(), GetDeviceHardware().c_str());
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "2"));
}

View File

@ -157,6 +157,7 @@ bool spi_flg = false; // SPI configured
bool soft_spi_flg = false; // Software SPI configured
bool ntp_force_sync = false; // Force NTP sync
bool ntp_synced_message = false; // NTP synced message flag
bool is_8285 = false; // Hardware device ESP8266EX (0) or ESP8285 (1)
myio my_module; // Active copy of Module GPIOs (17 x 8 bits)
gpio_flag my_module_flag; // Active copy of Template GPIO flags
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
@ -1591,6 +1592,7 @@ void setup(void)
snprintf_P(my_hostname, sizeof(my_hostname)-1, Settings.hostname);
}
GetEspHardwareType();
GpioInit();
SetSerialBaudrate(baudrate);