Merge pull request #9936 from s-hadinger/zigbee_eeprom_fix

Fix compilation error with CC2530
This commit is contained in:
s-hadinger 2020-11-21 17:58:46 +01:00 committed by GitHub
commit 589ebd72e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -18,6 +18,7 @@
*/ */
#ifdef USE_ZIGBEE #ifdef USE_ZIGBEE
#ifdef USE_ZIGBEE_EZSP
#include <memory> #include <memory>
#define Z_EEPROM_DEBUG #define Z_EEPROM_DEBUG
@ -453,4 +454,5 @@ int32_t ZFS_Write_File::close(void) {
return length; return length;
} }
#endif // USE_ZIGBEE_EZSP
#endif // USE_ZIGBEE #endif // USE_ZIGBEE

View File

@ -114,8 +114,8 @@ int32_t hydrateSingleDevice(const class SBuffer & buf, size_t start, size_t len)
// Parse the entire blob // Parse the entire blob
// return true if ok // return true if ok
bool hydrateDevicesDataFromEEPROM(void) { bool hydrateDevicesDataFromEEPROM(void) {
#ifdef USE_ZIGBEE_EZSP
if (!zigbee.eeprom_ready) { return false; } if (!zigbee.eeprom_ready) { return false; }
int32_t file_length = ZFS::getLength(ZIGB_DATA2); int32_t file_length = ZFS::getLength(ZIGB_DATA2);
if (file_length > 0) { if (file_length > 0) {
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device data in EEPROM (%d bytes)"), file_length); AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Zigbee device data in EEPROM (%d bytes)"), file_length);
@ -148,8 +148,10 @@ bool hydrateDevicesDataFromEEPROM(void) {
read_more = false; read_more = false;
} }
} }
return true; return true;
#else // USE_ZIGBEE_EZSP
return false;
#endif // USE_ZIGBEE_EZSP
} }
class SBuffer hibernateDeviceData(const struct Z_Device & device, bool mqtt = false) { class SBuffer hibernateDeviceData(const struct Z_Device & device, bool mqtt = false) {
@ -203,7 +205,7 @@ class SBuffer hibernateDeviceData(const struct Z_Device & device, bool mqtt = fa
* *
\*********************************************************************************************/ \*********************************************************************************************/
void hibernateAllData(void) { void hibernateAllData(void) {
#ifdef USE_ZIGBEE_EZSP
if (!zigbee.eeprom_ready) { return; } if (!zigbee.eeprom_ready) { return; }
ZFS_Write_File write_data(ZIGB_DATA2); ZFS_Write_File write_data(ZIGB_DATA2);
@ -221,6 +223,7 @@ void hibernateAllData(void) {
#ifdef Z_EEPROM_DEBUG #ifdef Z_EEPROM_DEBUG
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZbData - %d bytes written to EEPROM"), ret); AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "ZbData - %d bytes written to EEPROM"), ret);
#endif #endif
#endif // USE_ZIGBEE_EZSP
} }
#endif // USE_ZIGBEE #endif // USE_ZIGBEE

View File

@ -1853,10 +1853,12 @@ int32_t ZNP_Recv_Default(int32_t res, const class SBuffer &buf) {
// //
// Callback for loading preparing EEPROM, called by the state machine // Callback for loading preparing EEPROM, called by the state machine
// //
#ifdef USE_ZIGBEE_EZSP
int32_t Z_Prepare_EEPROM(uint8_t value) { int32_t Z_Prepare_EEPROM(uint8_t value) {
ZFS::initOrFormat(); ZFS::initOrFormat();
return 0; // continue return 0; // continue
} }
#endif // USE_ZIGBEE_EZSP
// //
// Callback for loading Zigbee configuration from Flash, called by the state machine // Callback for loading Zigbee configuration from Flash, called by the state machine