Sming - Open Source framework for high efficiency native ESP8266 development
User avatar
By pjakobs
#72497 Hi board,

I have inherited some sming based firmware but am having trouble getting it to compile on current sming.

The original problem is here:
Code: Select all   otaUpdater->addItem(bootconf.roms[rom_slot], romurl);

   if (rom_slot == 0) {
      otaUpdater->addItem(RBOOT_SPIFFS_0, spiffsurl);
   } else {
      otaUpdater->addItem(RBOOT_SPIFFS_1, spiffsurl);
   }
   otaUpdater->setCallback(otaUpdateDelegate(&ApplicationOTA::rBootCallback, this));

   beforeOTA();
   otaUpdater->start();


and it seems that 'otaUpdateDelegate' isn't defined in the current Sming framework anymore. However, when I change this to 'OtaUpdateDelegate' (with a capital o, as it is defined), I get the following error:

Code: Select all   otaUpdater->addItem(bootconf.roms[rom_slot], romurl);

   if (rom_slot == 0) {
      otaUpdater->addItem(RBOOT_SPIFFS_0, spiffsurl);
   } else {
      otaUpdater->addItem(RBOOT_SPIFFS_1, spiffsurl);
   }
   otaUpdater->setCallback(otaUpdateDelegate(&ApplicationOTA::rBootCallback, this));

   beforeOTA();
   otaUpdater->start();


it seems that 'OtaUpdateDelegate', for some reason, is typed 'void'. Also, it would seem that the parameters are somehow wrong, since it requires a bool as the second parameter and 'this' is an object reference.

This is my first encounter with Delegates in the c++ world. I understand what their general idea is, but here I am thoroughly confused.

Can someone enlighten me?

kind regards

pj