LowPowerLab Forum

Software support => Wireless Programming (aka OTA) => Topic started by: Humancell on June 06, 2019, 08:11:41 PM

Title: Understanding the OTA code ...
Post by: Humancell on June 06, 2019, 08:11:41 PM
Hello,

I'm trying to understand the OTA code, and have a few questions that I just can't figure out.  For some background, I'm working on a way for the OTA to occur from a Moteino connected to an ESP8266, pulling the HEX file from a server over WiFi.  :-)

I'm getting close, and ran into a few things tonight that I just want to make sure that I understand.

Looking at:  https://github.com/LowPowerLab/RFM69/blob/master/RFM69_OTA.cpp#L350

HandleSerialHEXData(RFM69& radio, uint8_t targetID, uint16_t TIMEOUT, uint16_t ACKTIMEOUT, uint8_t DEBUG)

So a "targetID" is passed into this function.  But then immediately below we grab the remoteID.

https://github.com/LowPowerLab/RFM69/blob/master/RFM69_OTA.cpp#L353

Then, within the function both targetID and remoteID are being passed to different functions.

What is the difference between a "targetID" and a "remoteID"?

I was thinking that they were one and the same ... and I even found in the code where a remoteID is being passed as a targetID parameter.

Thoughts?
Title: Re: Understanding the OTA code ...
Post by: Felix on June 06, 2019, 08:34:14 PM
I think they are the same thing.
I can't remember why I might have had them written like that, with 2 names.
Might have to do with some edge case I can't think of right now.
A quick way to "check" is to use the targetID in both places and see if something breaks.
Title: Re: Understanding the OTA code ...
Post by: Humancell on June 07, 2019, 11:42:25 AM
Thanks ... I'm slowly making my way through the code and might post other questions.  I'm also doing some other refactoring, and will post to a public repo once I get this done.  Hopefully in the next day or so ...