ImperialSpaceSociety/picotracker-Lora

Verify, if no fix is found and tx done, that we can read the past positions.

MedadRufus opened this issue · 0 comments

uint16_t delta_time = (uint16_t)(current_pos_ptr->minutes_since_epoch - temp_pos.minutes_since_epoch);

Delta time is calculated ok when current_pos_ptr->minutes_since_epoch is known. i.e. when gps fix is present. However, if no gps fix, are we able to recover the past positions? We will be dealing with roll overs since current_pos_ptr->minutes_since_epoch is unsigned, and likely the value will be negative when no fix.

For example, in the following log where no fix was found:

2021-04-28 00:48:53,612 INFO  TtnListener:96 - Message arrived on topic 'icss_lora_tracker/devices/icspace25_ttnv2_abp/up'
2021-04-28 00:48:53,621 INFO  TtnListener:102 - Message received: {"app_id":"icss_lora_tracker","dev_id":"icspace25_ttnv2_abp","hardware_serial":"00C7B88969018CF9","port":99,"counter":31,"payload_raw":"c4AABhMAAAAAAAC3HuD/0AGUY7ce4P85AYBjtx7g/9ABlGO3HuD/OQGAY7ce4P/QAZRjtx7g/zkBgGO3HuD/0AGUY7ce4P85AYBjtx7g/9ABlGO3HuD/OQGAY7ce4P/QAZRjtx7g/zkBgGO3HuD/0AGUYw==","metadata":{"time":"2021-04-28T00:48:53.397603706Z","frequency":868.3,"modulation":"LORA","data_rate":"SF7BW125","airtime":215296000,"coding_rate":"4/5","gateways":[{"gtw_id":"eui-58a0cbfffe800f4d","timestamp":11228355,"time":"2021-04-28T00:48:53.398327112Z","channel":0,"rssi":-75,"snr":9.75,"rf_chain":0}]}}
2021-04-28 00:48:53,622 INFO  PayloadDecoder:80 - Decoding 'CUSTOM_FORMAT_ICSS' message...
2021-04-28 00:48:53,623 INFO  ICSSPayload:123 - 
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-10 08:16:53
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-10 08:16:53
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-10 08:16:53
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-10 08:16:53
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-10 08:16:53
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-10 08:16:53
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-10 07:56:53

2021-04-28 00:48:53,624 INFO  PayloadDecoder:88 - ICSS payload:playback_days=0, load_voltage=32, no_load_voltage=32, temp=19, lat=0.000000, lon=0.000000, alt=0, request_error=0, reset_cnt=6, pressure=0, numsats=0
2021-04-28 00:48:53,624 INFO  HabitatUploader:104 - Uploading for 1 receivers: $$icspace25_ttnv2_abp,31,00:48:53,0,19,0.000000,0.000000,0,32,32,0,6,0,0*FF37
2021-04-28 00:48:53,626 INFO  HabitatUploader:131 - Upload payload telemetry doc f3669b941ed617912307770b90b8a88742a7ffbf91b861f3c235d5585ece8260: {"data":{"_raw":"JCRpY3NwYWNlMjVfdHRudjJfYWJwLDMxLDAwOjQ4OjUzLDAsMTksMC4wMDAwMDAsMC4wMDAwMDAsMCwzMiwzMiwwLDYsMCwwKkZGMzcK"},"receivers":{"eui-58a0cbfffe800f4d":{"time_created":"2021-04-28T00:48:53.62183Z","time_uploaded":"2021-04-28T00:48:53.62183Z"}}}
2021-04-28 00:48:53,763 INFO  HabitatUploader:135 - Result payload telemetry doc f3669b941ed617912307770b90b8a88742a7ffbf91b861f3c235d5585ece8260: OK

The correct timestamps were meant to be:

2021-04-28 00:50:33,394 INFO  TtnListener:96 - Message arrived on topic 'icss_lora_tracker/devices/icspace25_ttnv2_abp/up'
2021-04-28 00:50:33,401 INFO  TtnListener:102 - Message received: {"app_id":"icss_lora_tracker","dev_id":"icspace25_ttnv2_abp","hardware_serial":"00C7B88969018CF9","port":99,"counter":32,"payload_raw":"c4AAJhC3HuD/GQG3HuD/OQEOALce4P/QASIAtx7g/zkBDgC3HuD/0AEiALce4P85AQ4Atx7g/9ABIgC3HuD/OQEOALce4P/QASIAtx7g/zkBDgC3HuD/0AEiALce4P85AQ4Atx7g/9ABIgC3HuD/OQEOAA==","metadata":{"time":"2021-04-28T00:50:33.177848671Z","frequency":868.1,"modulation":"LORA","data_rate":"SF7BW125","airtime":215296000,"coding_rate":"4/5","gateways":[{"gtw_id":"eui-58a0cbfffe800f4d","timestamp":111008931,"time":"2021-04-28T00:50:33.178787946Z","channel":0,"rssi":-72,"snr":9.75,"rf_chain":0}]}}
2021-04-28 00:50:33,402 INFO  PayloadDecoder:80 - Decoding 'CUSTOM_FORMAT_ICSS' message...
2021-04-28 00:50:33,404 INFO  ICSSPayload:123 - 
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-28 00:16:33
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-28 00:16:33
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-28 00:16:33
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-28 00:16:33
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-28 00:16:33
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33
Lon=-0.209712,Lat=51.530170,alt=118,ts=2021-04-28 00:16:33
Lon=-0.209712,Lat=51.530170,alt=79,ts=2021-04-28 00:36:33

2021-04-28 00:50:33,404 INFO  PayloadDecoder:88 - ICSS payload:playback_days=0, load_voltage=32, no_load_voltage=32, temp=16, lat=51.530170, lon=-0.209712, alt=71, request_error=0, reset_cnt=6, pressure=0, numsats=4
2021-04-28 00:50:33,413 INFO  HabitatUploader:104 - Uploading for 1 receivers: $$icspace25_ttnv2_abp,32,00:50:33,0,16,51.530170,-0.209712,71,32,32,0,6,4,0*FB6F
2021-04-28 00:50:33,414 INFO  HabitatUploader:131 - Upload payload telemetry doc 03b2fa52a2dde3bcf315ed7aeefd75c6af5bca24a09ed5a6698cbf241c7ab9e3: {"data":{"_raw":"JCRpY3NwYWNlMjVfdHRudjJfYWJwLDMyLDAwOjUwOjMzLDAsMTYsNTEuNTMwMTcwLC0wLjIwOTcxMiw3MSwzMiwzMiwwLDYsNCwwKkZCNkYK"},"receivers":{"eui-58a0cbfffe800f4d":{"time_created":"2021-04-28T00:50:33.401789Z","time_uploaded":"2021-04-28T00:50:33.401789Z"}}}
2021-04-28 00:50:33,588 INFO  HabitatUploader:135 - Result payload telemetry doc 03b2fa52a2dde3bcf315ed7aeefd75c6af5bca24a09ed5a6698cbf241c7ab9e3: OK