Skip to content

Commit

Permalink
Auto update certain old RaspBee if they are factory new
Browse files Browse the repository at this point in the history
  • Loading branch information
manup committed Apr 8, 2018
1 parent 90e56c4 commit ab34e21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions de_web.pro
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ DEFINES += GIT_COMMMIT=\\\"$$GIT_COMMIT\\\" \

# Minimum version of the RaspBee firmware
# which shall be used in order to support all features for this software release (case sensitive)
DEFINES += GW_AUTO_UPDATE_FW_VERSION=0x260b0500
DEFINES += GW_MIN_RPI_FW_VERSION=0x261f0500

# Minimum version of the deRFusb23E0X firmware
Expand Down
15 changes: 14 additions & 1 deletion firmware_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ void DeRestPluginPrivate::updateFirmwareWaitFinished()
// done
if (fwProcess == 0)
{
gwFirmwareVersion == QLatin1String("0x00000000"); // force reread
fwUpdateStartedByUser = false;
gwFirmwareNeedUpdate = false;
updateEtag(gwConfigEtag);
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateIdle);
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT_LONG);
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
}
else // recheck
{
Expand Down Expand Up @@ -400,6 +401,18 @@ void DeRestPluginPrivate::queryFirmwareVersion()
fwUpdateState = FW_WaitUserConfirm;
fwUpdateTimer->start(FW_WAIT_USER_TIMEOUT);
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateReadyToStart);

// auto update factory fresh devices with too old firmware
if (gwDeviceName == QLatin1String("RaspBee") &&
!gwSdImageVersion.isEmpty() && nodes.empty() && sensors.empty())
{
if (fwVersion <= GW_AUTO_UPDATE_FW_VERSION)
{
DBG_Printf(DBG_INFO, "GW firmware start auto update\n");
startUpdateFirmware();
}
}

return;
}
else
Expand Down

0 comments on commit ab34e21

Please sign in to comment.