Skip to content

Commit

Permalink
Fix infinite reset loop in m5stack init
Browse files Browse the repository at this point in the history
Some new OTA code is causing the m5stack all-clusters-app to reset
during init, which results in an infinite reset loop.  This fixes it.

Fixes #14267
  • Loading branch information
msandstedt committed Jan 25, 2022
1 parent de95567 commit 046730d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,17 @@ AppCallbacks sCallbacks;

} // namespace

static void InitOTARequestor(void)
{
#if CONFIG_ENABLE_OTA_REQUESTOR
SetRequestorInstance(&gRequestorCore);
gRequestorCore.Init(&Server::GetInstance(), &gRequestorUser, &gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
#endif
}

static void InitServer(intptr_t context)
{
// Init ZCL Data Model and CHIP App Server
Expand All @@ -548,17 +559,7 @@ static void InitServer(intptr_t context)
NetWorkCommissioningInstInit();
SetupPretendDevices();
InitBindingHandlers();
}

static void InitOTARequestor(void)
{
#if CONFIG_ENABLE_OTA_REQUESTOR
SetRequestorInstance(&gRequestorCore);
gRequestorCore.Init(&Server::GetInstance(), &gRequestorUser, &gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
#endif
InitOTARequestor();
}

extern "C" void app_main()
Expand Down Expand Up @@ -621,8 +622,6 @@ extern "C" void app_main()
// Print QR Code URL
PrintOnboardingCodes(chip::RendezvousInformationFlags(CONFIG_RENDEZVOUS_MODE));

InitOTARequestor();

#if CONFIG_HAVE_DISPLAY
std::string qrCodeText;

Expand Down

0 comments on commit 046730d

Please sign in to comment.