MCPcopy Create free account
hub / github.com/LowPowerLab/RFM69 / CheckForSerialHEX

Function CheckForSerialHEX

RFM69_OTA.cpp:288–316  ·  view source on GitHub ↗

=================================================================================================================== CheckForSerialHEX() - returns TRUE if a HEX file transmission was detected and it was actually transmitted successfully this is called at the OTA programmer side ===================================================================================================================

Source from the content-addressed store, hash-verified

286// this is called at the OTA programmer side
287//===================================================================================================================
288uint8_t CheckForSerialHEX(uint8_t* input, uint8_t inputLen, RFM69& radio, uint16_t targetID, uint16_t TIMEOUT, uint16_t ACKTIMEOUT, uint8_t DEBUG)
289{
290 if (inputLen == 4 && input[0]=='F' && input[1]=='L' && input[2]=='X' && input[3]=='?') {
291 if (HandleSerialHandshake(radio, targetID, false, TIMEOUT, ACKTIMEOUT, DEBUG))
292 {
293 if (radio.DATALEN >= 7 && radio.DATA[4] == 'N')
294 {
295 Serial.println((char*)radio.DATA); //signal serial handshake fail/error and return
296 return false;
297 }
298
299 Serial.println(F("\nFLX?OK")); //signal serial handshake back to host script
300#ifdef SHIFTCHANNEL
301 if (HandleSerialHEXDataWrapper(radio, targetID, TIMEOUT, ACKTIMEOUT, DEBUG))
302#else
303 if (HandleSerialHEXData(radio, targetID, TIMEOUT, ACKTIMEOUT, DEBUG))
304#endif
305 {
306 Serial.println(F("FLX?OK")); //signal EOF serial handshake back to host script
307 if (DEBUG) Serial.println(F("FLASH IMG TRANSMISSION SUCCESS"));
308 return true;
309 }
310 if (DEBUG) Serial.println(F("FLASH IMG TRANSMISSION FAIL"));
311 return false;
312 }
313 else Serial.println(F("FLX?NOK"));
314 }
315 return false;
316}
317
318
319//===================================================================================================================

Callers

nothing calls this directly

Calls 3

HandleSerialHandshakeFunction · 0.85
HandleSerialHEXDataFunction · 0.85

Tested by

no test coverage detected