Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't update EEPROM reset counts at boot #435

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

MedadRufus
Copy link
Member

It may be causing lockup.

@MedadRufus MedadRufus merged commit 703e905 into icspace-dev Apr 11, 2022
@MedadRufus MedadRufus deleted the Dont-write-to-EEPROM-at-boot branch April 11, 2022 17:36
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 5, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 6, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 6, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 6, 2022
commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 00:09:28 2021 +0100

    printout system reset cause first

commit 08a126eab522398309d270b7054cf5d6fde05f87
Author: MedadRufus <[email protected]>
Date:   Wed Sep 22 00:21:20 2021 +0100

    print a max of 30 past positions for debugging (#181)

    So that the printout time period will be deterministic. The time period of printing exactly 30 past positions
    fixes  #89

commit 812e1af4e9af2607e983cdc64d18d8c85d7431ff
Author: MedadRufus <[email protected]>
Date:   Tue Sep 21 23:57:25 2021 +0100

    Put in features and instructions (#180)

    * Put in features and instructions

    * Put in more screen shots

    * update nvm description

commit 385d740c73346598797c9999ce71c7baae747ebe
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 21:20:20 2021 +0100

    Ensure MCU and GPS don't run at same time(#177)

    While GPS is searching, put MCU into deep sleep. Use RTC timers to wakeup to poll. During all delays, deep sleep. Poll GPS every 4 seconds. The commit creates the drivers for deep sleep delay.

commit 60a6782f2274ff32a9c8f400fbfd0d875c3d571e
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:28 2021 +0100

    Revert "Remove all unnecssary code from ublox code (#174)"

    This reverts commit 48249a66343610bcbdb6648491381da6d1fa4638.

commit e1bf6b415313639ba9e1c93ef84212aca2f4807a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 20 12:04:25 2021 +0100

    Revert "Use Ublox PPS pin to indicate bytes available/Clean up ublox implementation (#176)"

    This reverts commit d14f7f6b3a6630ea499cf38fc88bd9e819df0c63.

commit 3a90ee…
MedadRufus added a commit that referenced this pull request Aug 25, 2022
commit 46219622c1437a91653553dd38d8da9fc27b8210
Author: Medad Newman <[email protected]>
Date:   Thu Aug 25 21:07:49 2022 +0100

    Minimise changes from stock loramac node code (#447)

    Fixes #446
    Also, significant simplification of main.c has been carried. It has not been tested though.
    Minimizes the diff between our code and loramac-node code v4.4.7(which our code is based off).

commit fa1a6b613691f293d8ae41102fa9a3e05f1f2cf0
Author: Medad Newman <[email protected]>
Date:   Wed Aug 10 22:01:48 2022 +0100

    [bug] enumerate through all the registrations in printout (#451)

commit 9a822565148e3a0282f7ee59c75eb9efb3d46911
Author: Medad Newman <[email protected]>
Date:   Sat Aug 6 17:39:14 2022 +0100

    Fix tooling settings (#449)

    Fix output directory paths for cmake and the cpputest vscode plugin.

commit 5fca4108f452c56545d6b73f6062e51966cd9300
Author: Medad Newman <[email protected]>
Date:   Sat Aug 6 17:37:13 2022 +0100

    Revert redundant changes in LoRaMac.h and LoRaMacCrypto.c(unittests pass) (#448)

    Revert unnecessary changes from stock loramac-node implementation

commit 0dc49c4376510ebc6f79d725a1a59dd0001223f5
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Aug 6 16:36:51 2022 +0100

    Revert "revert redundant changes in LoRaMac.h and LoRaMacCrypto.c"

    This reverts commit 81ad56b175d4eee69034f3a9b3ae7328e4464790.

commit 81ad56b175d4eee69034f3a9b3ae7328e4464790
Author: Medad Rufus Newman <[email protected]>
Date:   Fri Aug 5 22:31:03 2022 +0100

    revert redundant changes in LoRaMac.h and LoRaMacCrypto.c

commit 7ad757ed744f904a97f07a0600aabc8d29d5ea18
Author: Medad Newman <[email protected]>
Date:   Wed Aug 3 22:08:43 2022 +0100

    Use more cmake presets (#445)

    * add build presets

    * Use cmake configs in CI workflow

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update CMakePresets.json

    * Update cpputest.yml

    * Update cpputest.yml

    * Revert "Update cpputest.yml"

    This reverts commit a8d205b49e34806637bf9ffa4a2145904bb370bf.

    * Revert "Update cpputest.yml"

    This reverts commit f184662b53a43d4463d1dbe6cff94dd1230c04ff.

commit 225cc8aca8be08b879d745a8d5cbd6837beb9952
Author: Medad Rufus Newman <[email protected]>
Date:   Tue Jul 19 18:49:39 2022 +0100

    Use CMake Presets to configure CMake

    Don't use the VS code settings file, to keep it IDE independent.

commit 4007e35f7175c7dae0e76857d18ea241ea739b84
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 17:11:42 2022 +0100

    use ctest directly (#444)

commit 22bc5d6716339ece5712090b72965af67a1e7524
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 15:31:00 2022 +0100

    Add Cpputest workflow and temporarily ignore failing tests (#442)

    Have to fix or enable the tests later.

commit 2b9ddef0efe0713b09811a6751f154d3089faa9e
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 14:18:16 2022 +0100

    loosen requirement for eeprom usage limit

commit def329eeb3ecf27244f7f71ff84940f92cf61dda
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:48:07 2022 +0100

    cleanup indentation

commit 73dbc5acd3cb52b1b27e08d8c7fd58ade90a0330
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:46:37 2022 +0100

    remove lz4 remnants

commit 04fc54adb07f2704fdf44b1525aa48ac76855b44
Author: Medad Rufus Newman <[email protected]>
Date:   Sat Jul 2 09:45:56 2022 +0100

    add stub for WDG_Init(void)

commit ca10b1fbccbd105ea093c49d3788fd5cd9cb6ce9
Author: Medad Newman <[email protected]>
Date:   Sat Jul 2 02:15:42 2022 +0100

    Add CI pipeline (#441)

    Partially fixes #430

commit c617e99314437a3c9964623e7a7de20d1f400112
Author: MedadRufus <[email protected]>
Date:   Mon Apr 18 14:59:16 2022 +0100

    Enable debug printout

    Fly what we test

commit 567bc8f3a28bf3f3b4e0159bee79434495a41eaa
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 22:19:40 2022 +0100

    No longer use Deep sleep for when waiting for GPS fix (#439)

    Its proving hard to program, and makes it hard to program the Hardware independent watchdog option byte(IWDG_SW). There is no avoiding the spikes due to processor turning on, so keep it on always. Only exception is when doing TX, then put processor in low power mode.

commit dfa429adcab0696dd4143ade307e17400276e7de
Author: MedadRufus <[email protected]>
Date:   Tue Apr 12 20:35:31 2022 +0100

    increase watchdog timeout to 10 seconds

    The program seems to need around 5 seconds timeout, so 10 seconds+- 50% due to internal rc oscillator variations is OK.

commit ecdd7f989ed4cd14be6894f489ee4deb83d80a47
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 20:25:47 2022 +0100

    Start watchdog earliest and shorten watchdog interval (#426)

    Try to ensure the watchdog is running as early as possible by making the watchdog init the first instruction of the program. Then also reduce the watchdog timeout period to 8 seconds.

commit a185aba2400db9f9004867d588559b6dd1a4e4ef
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:19:34 2022 +0100

    Use conventional delay at boot (#437)

    Maybe the DeepSleepDelayMs is causing issues.

    put in required import for delay

commit 57efa3bce29be0866e94dc8a29e02d29cd8e39de
Author: Medad Newman <[email protected]>
Date:   Tue Apr 12 19:15:49 2022 +0100

    [BUG FIX] Ensure CRC check for settings works (#436)

    Fixed bug where it was not reading the correct lorawan credentials. Fixed the tests that broke as well.

commit 703e905b485c7e98c8c48f12d125dd3d8fe3ef26
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:36:28 2022 +0100

    Don't update EEPROM reset counts at boot (#435)

    It may be causing lockup at boot.

commit 63d550bfdd826d57cb40308c56580e92991597f0
Author: Medad Newman <[email protected]>
Date:   Mon Apr 11 18:28:05 2022 +0100

    bring back 3 more registered Helium devices (#432)

    * bring back 3 more registered devices

    * put the 3 more devices back into use

    * reallocate

commit f95e2bec21ad2de46a24ca11a25b44f9375b3f6a
Author: MedadRufus <[email protected]>
Date:   Thu Apr 7 20:04:21 2022 +0100

    don't initialise or pull down the GPS int pin

commit faf0084f0b40be0861ee4f1ad72a349ab42ee9bd
Author: MedadRufus <[email protected]>
Date:   Sat Apr 2 19:02:56 2022 +0100

    Increase helium frame count to 731

commit cf4cf9ac3a068c7cd1693ecc47f2d6373a37b287
Author: Medad Newman <[email protected]>
Date:   Sat Apr 2 18:58:37 2022 +0100

    Use LSI crystal instead of LSE crystal for RTC (#427)

    * use LSI crystal for RTC instead of LSE crystal.
    * scale RtcTick2Ms() and RtcMs2Tick() by right amount to account for 32.768 kHz LSE vs 37 kHz LSI oscillator
    * Increase RX window tolerance from 20 ms to 500 ms to account for inaccuracy of RC oscillator(LSI)

commit 1c72f343885c2b218291dc78ddb97f180d3f7b03
Author: MedadRufus <[email protected]>
Date:   Fri Apr 1 20:46:39 2022 +0100

    Use on eeprom wipe that works on target.

    Earlier implementation will hang the device.

    Update NvmDataMgmt_ut.cpp

commit 2fb7a7b18b5251f80763e510f2c75cfbddc0818e
Author: MedadRufus <[email protected]>
Date:   Mon Mar 28 22:12:05 2022 +0100

    Start Helium frame count at 700

    One of the devices has used frame 700

commit 5fe9b4bf94e27ad6b7a83048798f4a32be31ab39
Author: MedadRufus <[email protected]>
Date:   Sat Mar 26 15:47:48 2022 +0000

    save gps config to BBR

    This is important, or else it ends up loosing this info when power cycled(with battery backup connected)

commit 0af004be598cce60e67cef1eae52249eef949873
Author: MedadRufus <[email protected]>
Date:   Thu Mar 24 18:46:56 2022 +0000

    Init GPS interrupt pin as pulled down

    Consistent with the code on earlier picotracker-lora codebase

commit 5b6fc2fbcae2cb53d27bbd8408e54955bec90767
Author: MedadRufus <[email protected]>
Date:   Tue Mar 22 19:57:51 2022 +0000

    Allow NMEA messages from GPS

    Useful for debugging with U-center.

commit 2a4f8c7e117458dc3ceae62b9cb12cf34cf09af4
Author: MedadRufus <[email protected]>
Date:   Sat Mar 19 14:54:07 2022 +0000

    Don't use power save configs on GPS at all.

    Revert back to behaviour on ICSPACE23, 24 where it worked down to 1 degrees solar elevation without any issues. It never even use the GPS power save configs.

commit 628423accaaf92be19325c68ad97f732919d771c
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:48:12 2022 +0000

    Send checksum of all internal settings in the bitfields message field

    Reads all the settings stored in the EEPROM, gets a CRC8 value of it, and sends it as part of the telemetry message.

    Adds in unittests to verify successful hashing.

commit 5b1aa86df65c4f77043e8e4daa0bfd4abeab0876
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:47:53 2022 +0000

    Remove redundent return values and cases

    The return values are not used for anything. Also removes a switch case that does nothing.

commit c936085aac0d195bbedb75609c5527c09237c966
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:30:32 2022 +0000

    remove all set_bits() and clear_bit() references

    No longer used. Next commit will instead send a CRC of all settings, which is a more robust way of knowing if the tracker received the settings change request.

commit 91e854bff0dc158eb1ac4576466953c0e5c820e5
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:15:36 2022 +0000

    Add in CRC8 implementation

    Useful for sending an 8 bit hash of EEPROM settings.

commit bd2da59751093841956ccc02603abae14eb9832d
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:36:00 2022 +0000

    refactor function name save_to_eeprom_with_CRC()

    save_to_eeprom_with_CRC() refactored to save_lorawan_keys_to_eeprom_with_CRC() to make it more descriptive.

commit 7737e32ff8b5b848d999d90d79d0c6ce7ffe4eea
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 18:42:32 2022 +0000

    Change signature of read_geofence_settings_in_eeprom()

    Now takes a pointer to a buffer that gets filled with geofence settings in EEPROM. Important for getting the settings out for getting a hash off later.

commit b3974842db7cdd5520059c49b5afcffd8019a984
Author: MedadRufus <[email protected]>
Date:   Thu Mar 17 21:04:18 2022 +0000

    Make it possible to wipe less than 4 byte chunks of EEPROM

    Uses the slow wipe(one byte by one byte) method for less than 4 byte chunks, and continues using the 4 byte at a time fast wipe for chunks larger than 4 bytes. Implements unittests to test all of these.

commit 7066f5c9caa394311e90c9836e308fccd296d370
Author: MedadRufus <[email protected]>
Date:   Mon Mar 14 20:19:19 2022 +0000

    swap around arguments

commit 927174c7645d85af98a0f4f0e95866939028039e
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:44:10 2022 +0000

    Create seperate eeprom settings manager (#419)

    One stop shop for saving settings to EEPROM. Its a separate file for managing settings

commit 4e9d0fa3b80f580731484d5a619105471b2558cf
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 23:30:04 2022 +0000

    Return array not struct (#418)

    * return an array of geofence settings not the whole struct

    * pass array to unittests as well

commit 94c4c5dc6ee4194efbbb296fa336514399d9468c
Author: Medad Newman <[email protected]>
Date:   Sat Mar 12 19:13:02 2022 +0000

    Store geofence enable/disable mask (#414)

    * Store enable/disable mask in EEPROM
    * make it possible to send a downlink that will be able to change the enable/disable mask
    * CRC is written with the mask for data integrity checks
    * unittests added to verify successful overwriting of the mask

commit 6eb3cf357c4ef06d8d954652aa582a8a1f6dd896
Author: MedadRufus <[email protected]>
Date:   Sat Mar 12 18:21:57 2022 +0000

    return OUTSIDE_polygon by default

    Use the design pattern of initialising the default return value at beginning and then change it later.

commit eda2b0041eafb234e629b0223bc76efab84eb767
Author: MedadRufus <[email protected]>
Date:   Mon Mar 7 21:23:06 2022 +0000

    swap around API arguments

    keep it consistant with both read and write API

commit 7f51ecf0a65d0244dc52d588de0a50a0888f673e
Author: MedadRufus <[email protected]>
Date:   Sat Mar 5 17:10:59 2022 +0000

    init LED as on

    This will allow use to discover if it gets stuck at RTC initialisation

commit 58d643100920edc768600621cc8a12c5b4e97bef
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 18:47:35 2022 +0000

    Fix unittests (#412)

    Fixes some unit tests but not all.

    * ignore locking tests

    These cause the computer to hang

    * default interval

    * get rid of useless tests

    * use cleaner test for network key cycling

    Only check the dev address. No need for the rest

    * simplify the test

    * commenting/formatting

commit 858a9b48a3c880fe12be90c6926b5028a75b42c9
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:30:20 2022 +0000

    change dyanmic model only if it has to be changed (#407)

    Change dyanmic model only if it has to be changed. And if it has to be changed, then send all the other GPS setup instructions. When the GPS browns out, it resets all settings, so we need to send them all over again. Earlier, the instructions were sent before each fix attempt, but I suspect this slows down the time to fix. So now, send the instructions only if the settings were incorrect.

commit 604dad23486c39f3cef527e7afd59a38019c3604
Author: Medad Newman <[email protected]>
Date:   Sat Feb 26 17:11:41 2022 +0000

    Ukraine geofence (#410)

    * add in Ukraine in geofence kml

    * Restrict transmissions over the Ukraine

    * slightly enlarge the area

commit 85f46e035fee9fef567a54cc6ed746f99262e73f
Author: MedadRufus <[email protected]>
Date:   Sat Feb 26 16:24:56 2022 +0000

    fix eeprom wipe args error and unused variable

    Update cli.c

commit 591815940cf3daffcf4e024c768e0adcd26ddb63
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:47:50 2022 +0000

    Use unique set of keys each region (#403)

    Fixes #391

commit dfec5b03b15245bd17b07bd106d9566cd13a34e5
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:20:38 2022 +0000

    Increase GPS search time to 180 seconds (#402)

    revert back to 180 seconds search time as used on earlier files(bar icspace26). It seemed to struggle to get a fix in 120 seconds.

commit 4e093e07a13d2273e37e1d3cd1672df9166926f8
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 23:18:22 2022 +0000

    Set GPS search time in downlink (#401)

    Send an downlink from ground to set the GPS search time. Reuses the same code structure for setting the tx interval.

commit 3d6ed5fd54950fcebc304d6cd5815b9b3f2af356
Author: MedadRufus <[email protected]>
Date:   Sat Feb 19 23:12:07 2022 +0000

    reorder #defines for readablity

    Its easier to put the address first and then the length

commit 7dff89fa530a51725509f27cbf9c413815b2d7b1
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 22:23:17 2022 +0000

    Rapid wipe EEPROM from downlink (#399)

    Wipes out the EEPROM and sets a flag in the status field in the next uplink. Allows ground control to sent a specific range of addresses to wipe.

commit d447bce6832ab25328b3003c304e4f2107bc557f
Author: Medad Newman <[email protected]>
Date:   Sat Feb 19 19:07:21 2022 +0000

    Remove all compression code (#400)

    We don't do compression

    * removes all files related to compression

    * more removal

    * remove from unittests

commit 5590cddd2a29f5adcddc56fd4dda1d00f88f7e77
Author: MedadRufus <[email protected]>
Date:   Wed Feb 9 21:59:58 2022 +0000

    Transmit as often as possible(2 seconds intervals)

    Transmit in 2 seconds intervals. When the tracker is pointed in the right direction, make sure it transmits as often as possible.

    The commit also cleans up some code.

    Update config.h

    preserve configs

    Revert "preserve configs"

    This reverts commit ea126823eb6a4b264771790b374eb4ebb10ab49b.

commit d12f75343f257259f4626b53b81846763ed72a1b
Author: Medad Newman <[email protected]>
Date:   Thu Dec 30 16:57:39 2021 +0000

    Update README.md BOR instructions (#383)

    Use unique credentials for japan (#384)

    * use unique keys over japan for helium

    might have to change it later in the air

    * dedicate helium19 & 20 solely for Japan

    add in 2 more credentials for Japan (#385)

    * use unique keys over japan for helium

    might have to change it later in the air

    * add in 2 more ttn credentials for japan

    * fix tests for eeprom range

    Revert "add in 2 more credentials for Japan (#385)"

    This reverts commit 395bb7cb98518264d3a3073823563b90f8b1e48e.

    Revert "Use unique credentials for japan (#384)"

    This reverts commit 78c342f8ad93416850e56b113c64ae00ee2711b6.

commit 4b6c03f66d09b28d7d3d6b5c6268469a83f3704c
Author: MedadRufus <[email protected]>
Date:   Thu Dec 30 15:46:01 2021 +0000

    increment helium starting frame count to 130

    Some was consumed

commit c13e56ee100a801749513415798d1fd018fc8ccc
Author: MedadRufus <[email protected]>
Date:   Tue Dec 28 21:00:38 2021 +0000

    start helium frame count from 70

    And move the setting to config.h where all other settings are.

    Update LoRaWAN_config_switcher.c

commit 0e15c85847a58f45d99b027b95d8a6260f40c18d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 24 00:24:39 2021 +0000

    don't set brownout level here (#379)

    Its causing the tracker under some conditions to get stuck. Fixes #371

    completely delete the brownout level setter

    its totally broken. Just set it from STM32cube programmer

commit cfe868b187427c398768d2e8f7a09f6fb3dd8d76
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:34:49 2021 +0000

    Reintegrate keil (#377)

    * Revert "Drop Keil support"

    This reverts commit ae4496c8e247e609248b6584c58042a40143bfc7.

    * delete compression code

    * remove duplicated variables

    * keil stuff

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * Update periodic-uplink-lpp.uvprojx

    * delete all other variants

    * Update periodic-uplink-lpp.uvprojx

    * allow more regions

    * explicitly declare void for no arguments

    * do not add argument for non void function

    * remove passing of current region

    Redundent

    * remove unused variables

    * void functions for no args

    * Revert "delete compression code"

    This reverts commit d8c758bc3333a244ca0c504cbeaf421e7fca76cf.

    * preserve configs

    * fix warnings

    Clean up keil integration (#381)

    * remove duplicate declaration

    * ignore debug config files

    not necessary to track

    * ignore scvd file

commit ff0edd9acc84ffe47fb89f5b54fd7b129bba53ac
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 00:16:15 2021 +0000

    Revert "preserve configs"

    This reverts commit 47feaf02d2caaab9b89d9cbad5f15a9218664e01.

commit db3558b6349073a87667d6b44dcad613345cd0a7
Author: Medad Newman <[email protected]>
Date:   Thu Dec 23 20:31:25 2021 +0000

    preserve configs

commit 4c4d57b0a616ed7e4937fa8f347e8a4e06624e30
Author: MedadRufus <[email protected]>
Date:   Fri Dec 24 01:43:22 2021 +0000

    Revert "use LSI instead of LSE crystal (#375)"

    This reverts commit 26415be526262c15723aae2f21081ecd1307a19c.

commit 7f14be4cf0015f431a5dc423826d63e03ba253c7
Author: Medad Newman <[email protected]>
Date:   Wed Dec 22 13:44:13 2021 +0000

    use LSI instead of LSE crystal (#375)

    * use LSI instead of LSE crystal

    There is an issue with one of the test trackers, that is not initialising the LSE.

    * Set clock dividers for LSI RTC

    Might fix #371. Fixes #373

commit dcd18c3ab1722b93a15ca9c107282979129c06a6
Author: MedadRufus <[email protected]>
Date:   Wed Dec 22 17:33:50 2021 +0000

    use GPS only when enabled

commit ada63af147ea638ade7f7e273604b91ddbc73322
Author: MedadRufus <[email protected]>
Date:   Fri Dec 17 02:51:05 2021 +0000

    start helium at frame 33

commit 9c39c6cdd587b313b567c19c1330610c8cb6ff6d
Author: Medad Newman <[email protected]>
Date:   Fri Dec 17 00:35:29 2021 +0000

    Add in 10 more helium registrations(#370)

    Would fix #368.

    Each device can handle 65535 frame counts before having to do a join request again. So by registering 20 helium devices, we can allow up to `65535 * 20  = 1310700` transmissions which would take around 262 days to run out.

    Its important to know that we can send a downlink with new session keys as necessary after 262 days.

commit e98d4c6805452e869a437bd374933faf57a267dc
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 16:24:40 2021 +0000

    fix datarate test

commit c95ad86000ec7f50e023faf1af3291c48569a894
Author: MedadRufus <[email protected]>
Date:   Thu Dec 16 03:49:19 2021 +0000

    start at 70000 fcount

    This is for the helium network

commit 26e0ff35242bbd1f6d2870fea2f65e4010aa60cb
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 03:35:25 2021 +0000

    Use dr4 for max range (#367)

    * use DR4 everywhere

    It was the one used on ICSPACE22 around the world. It has a higher chance of being received I think

    * send only 4 past positions

    To ensure we stay within 200 ms airtime at this spreading factor(SF8)

commit aabf8ab6c99bf5292e5c87e7aaf4cd9e700ab966
Author: Medad Newman <[email protected]>
Date:   Thu Dec 16 00:15:54 2021 +0000

    Fix unexpected resets (#366)

    Just set the next interval shorter.

    fixes #365

commit 83dd16dbf2489efd58083711c6fccd9a89682760
Author: Medad Newman <[email protected]>
Date:   Wed Dec 15 03:19:51 2021 +0000

    update session keys correct way (#364)

    Regenerate ALL session keys from on target. No longer uses virtual device/virtual gateway. It MAY fix #360 and #339. Maybe.

commit a893062198139a7fbc47e7a20a74fa734db18549
Author: MedadRufus <[email protected]>
Date:   Tue Nov 30 02:15:00 2021 +0000

    use 3 byte past position (#356)

    * use 3 byte past position

    send absolute value

    * send fewer past positions

    to keep packets small

    Update playback.c

commit a61f56b486a0a213b8c6438573e43bd8c7d2ec0b
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 22:03:23 2021 +0000

    Printout current device registration (#348)

    Useful for debugging

commit e43f77ae5899fecfa8e6051a1eb01aace9ce094e
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 21:30:41 2021 +0000

    put in new icspace10 credentials (#352)

    hopefully fixes #339

commit bf5c0fcf17b1997c9e2289b469e47f511fdbe92a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 26 00:04:34 2021 +0000

    make helium icspace10 become icspace7 (#351)

    Workaround, because for some reason, the icspace10 helium credentials have become invalid.

commit 34ede74be2ec0784d1be0494eaac359790751b3f
Author: MedadRufus <[email protected]>
Date:   Wed Nov 24 23:22:37 2021 +0000

    Fix tests (#349)

    fix some low hanging fruit tests

commit ec895d0e30dda486568b3ed859a8ae670422f0f1
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 22:12:49 2021 +0000

    Fix whacky temperature readings (#344)

    Use more high level functions from the hal library, don't mess with low level. Greatly simplified the temperature/vdd reading.

commit 145c8297b9e801744792a2fb595bdac7112b63b7
Author: MedadRufus <[email protected]>
Date:   Tue Nov 23 20:32:22 2021 +0000

    Fix gaps in tx (#346)

    tx immediately after a non-transmission as its meant to.

commit 62bc3b1cc4b66f784a7927efabb6ba3b1f889efb
Author: MedadRufus <[email protected]>
Date:   Mon Nov 22 23:31:17 2021 +0000

    do 2 transmissions on each network (#340)

    Do 2 transmissions on each network, not one.
    Fixes #341

commit 3b1e198316283f7d616e273319ba26a626b17876
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:33:45 2021 +0000

    Shorter tx intervals (#334)

    * Update config.h

    * Update config.h

commit 32b79e5732ea2489c7d9ec12caf522674ca57b93
Author: MedadRufus <[email protected]>
Date:   Fri Nov 19 01:30:40 2021 +0000

    Expand geofence (#333)

    * Update geofence.kml

    * put in maldives and expand japan & philipines

    * update shapes

commit c8db44eb92095308ded810c632a45d5bec4bea16
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:30:31 2021 +0000

    Update README.md

commit 02bb269f695d2faff2f6dccdb0fae1079b39a557
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 02:25:22 2021 +0000

    Update README.md

commit b9a1da921ebedd1a91e82a59faac1a5fc31a4269
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:45:49 2021 +0000

    reduce gps fix time (#330)

    Give it max 120 seconds to search. Its OK if it txes empty packets. proof of life is OK.

commit 5ed09a5cd0ffa53116d91cc329e1b2b8825bed1e
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:42:40 2021 +0000

    use dr 5 over china and as923 (#327)

    Lets not use much airtime. More airtime could mean higher chance of radio brownout.

commit 555b7aa65f7cd524021ae209ee51c805d6c9f8c5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 18 01:41:53 2021 +0000

    tx on helium more often over China

    Fixes #329

commit b09f63a7c4f27af7a971b53952f551121937077c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 01:15:19 2021 +0000

    Add in israel as923_4 (#322)

    Put in a geofence for Israel, transmitting on the AS923_4 region.

    Fixes #282

commit 9ec9869761b21fc14984e07771e363b01be59c1c
Author: MedadRufus <[email protected]>
Date:   Sat Nov 13 00:46:38 2021 +0000

    refactor PHILIPPINES_polygon to AS920923_PHILIPPINES_polygon

    Update geofence.c

    Update geofence.c

commit fa7d61877b9033809c0bf037d07a6a2f844fbe2a
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 23:21:22 2021 +0000

    Use as923_2 settings for phillipines (#312)

    Makes the tracker transmit on AS923_3 subband over the Philippines. According to the RP-2-1.0.3 regional spec, the Philippines uses the AS923_3 subband, which has non-overlapping frequencies with the AS923_1_JP subband which was used by default earlier. The code configures which subband to use ahead of ahead of initialising the AS923 module.

    Tested on target in commits e1be7ff1b67fe6522e2bea545676a4110ed3ffee and 8201ce2f7c9d17b12e1ab9eb0ae30c2cced44b15

commit 002a2c1c720f11beaf35716646c5e22d804f9d60
Author: MedadRufus <[email protected]>
Date:   Fri Nov 12 00:12:58 2021 +0000

    Remove redundant variables (#323)

    Prep for AS923 sub regional changes. Removes all the redundant variables which we don't use anymore.

    * no need to send region in lorawan settings

    get it from the geofence get function

    * remove redundent test

    * Update LoRaWAN_config_switcher.h

    * remove otaa setting

    * get loramac region from geofence module

    * remove tx_interval setting

    Now its set at a constant interval around the world. No changes between regions.

commit 459ebbee7df1014303e9c4ef6d73b6db5ec0bad5
Author: MedadRufus <[email protected]>
Date:   Thu Nov 11 01:30:21 2021 +0000

    Ensure corrupt Loramac region in EEPROM will not cause lock (#320)

    The code now checks if the loramac eeprom region is a valid one, and prints out only valid ones

commit bfda0496932d1f961f71f06f0c688586abe09ed2
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:59:13 2021 +0000

    Test playback stats recovery (#318)

    fixes #254

    * seperate out function

    * don't initliase playback stats with non zero values

    * test when eeprom is corrupted

    * one more test, with valid eeprom

    * put in success test

commit c7857965163c21b8e462cf196adde8f9ce226d63
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:35:39 2021 +0000

    Fix playback test (#317)

    Don't touch the interval bsp.c implementation for the test. Set the default values from an extern.

    Update bsp.c

commit 3a1c46aecf4199af4bb5f503c5e2a0ffca61d627
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:23:24 2021 +0000

    fix implicit declaration

commit 20ebec52a5143f176186182942cdf8d09fef7d99
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 23:11:43 2021 +0000

    Set tx interval in uplink (#316)

    Send an ack or nack when successfully saving tx interval to EEPROM. If value in EEPROM does not pass crc check, just use the default tx interval(20 seconds). Tracker will read the eeprom value before setting tx interval.

    WARNING: do not set it above 25 seconds tx interval, as it could mess with the watchdog, causing infinite loops.

    * use only one tx interval

    No need for seperate one for GPS no fix, as now the code makes the GPS wake up immediately after a tx is complete

    * set tx interval in eeprom

    Send ack or nack

    * formatting only

    * put in test for tx interval success

    * Update callbacks.c

    * autoformat and remove useless non-code

    * simplify defines

    * fix length limits

    * tx interval eeprom strcut

    * read and write functions of eeprom tx interval

    * put in size tests

    * use eeprom value

    * return correct value

    * fix test

    * Autoformat only

    Autoformat bsp.h in prep for the next commit

    * formatting

    * remove dedundent defines

    * fix define

    * remove redundent

    * remove redundent code

commit b14bf060012d6ba5fc99ee9551d9e6fd772ebb69
Author: MedadRufus <[email protected]>
Date:   Tue Nov 9 22:40:43 2021 +0000

    Autoformat only

    Autoformat bsp.h in prep for the next commit

    remove useless commented code

commit 5d3d5cdbc5cd777eca57139102e6eefa621e18e8
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 23:54:35 2021 +0000

    Don't tx where not allowed (#315)

    Don't tx in regions of the world where we are not meant to TX over. This applies to North Korea only at the moment.
    This commit ensures it does not tx in regions where the geofence module tells us not to TX over.

    A unittest is added for ensuring North Korea is set to NO tx.

    Fixes #287

commit 91e7176c1fbcb31f05149bee34214398052f2692
Author: MedadRufus <[email protected]>
Date:   Sat Nov 6 12:04:10 2021 +0000

    Send ack when polling eeprom past data (#313)

    fixes #266.

    Set the bitfields to ack or nack when a request from ground polling a specific time range is made. Creates unittests to ensure it has the expected behaviour. Code also removes unnecessary fields.

commit 0cc29a63a90166712390bff14cabf2fa12909c2e
Author: MedadRufus <[email protected]>
Date:   Wed Nov 3 00:03:43 2021 +0000

    Setup GPS only once before TX (#311)

    Don't do it twice. It could be resetting all the settings if its called twice, causing lower sat count and hence poorer GPS fix.

commit 80fc59016464b2e0780fda626799dadb3dd64f38
Merge: 2e613414 9d292481
Author: MedadRufus <[email protected]>
Date:   Tue Nov 2 23:48:51 2021 +0000

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 2e613414dca768660ade5c7149e4efd476e826fe
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 23a091a124841a4c0ecfecc008e2d462090f2b67
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 6bae1517ade6221a9d4184353809f9e8262d32b5
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit 4273f7826297db0a80f7684b3b0fbe158c56a578
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm in CN470 (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 9d292481090df16a6e4feae4fb20571870ad10d7
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:40:55 2021 +0000

    update eeprom workaround

    Put in tests and comments to ensure its not changed

commit 0a493d6f180167760e47e9022a10810d366e74bd
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:44:47 2021 +0000

    Increase altitude range (#302)

    Increases range in altitude that can be encoded into the telemetry string and EEPROM.

    * increase altitude range to 65536
    * update the decoder

    fixes #286

commit 52c26fa3edffbdc6b1a8e0d455392f95b2e8e940
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:49 2021 +0000

    label must pass test

commit 14d44e214cfe0cab6f78a4558a02259a5ef6bb36
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 21:36:14 2021 +0000

    Randomly pick the network registration to tx on on startup  (#301)

    This commit randomly picks the network registration to tx on at startup. This ensures that if it browns out often, it does not rapidly increment the frame count of the first device registration.

    The commit sets random seed at boot with the Radio, creates function to set counter randomly and then initializes the  value of the counter soon after boot(before GPS is turned on).

    Fix random device credential start (#307)

    Set random seed BEFORE using the rand function

commit b7992c270e35cab86d95cbd9b07daf65bea53c46
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 23:34:23 2021 +0000

    Fix eeprom overflow (#304)

    For some reason, the pre-compiler is not raising the overflow of eeprom error error. Mystery. Not going to fix it. Instead, use unittests to detect this error.

commit f8d5677b7995d36dfea56e6e7f09a9e8b3132fe3
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 22:22:17 2021 +0000

    increase max EIRP to 30 dbm (#303)

    Increase EIRP to 30dbm, but note that the tracker has filters on the 470 Mhz band, so a much lower power will be transmitted via the telemetry antenna

commit 6fddf889f1bb6e3b7a16da7a90a58af2e8d6f625
Author: MedadRufus <[email protected]>
Date:   Mon Nov 1 20:44:44 2021 +0000

    Setup gps as soon as the final step in tx is complete (#300)

    This commit makes the GPS turn on as soon as a tx/rx is completed. This will ensure that the tracker is drawing come current all the time, somewhat reducing the solar panel voltage. This could protect the electronics somewhat, as the solar panels output too high voltage for the ICs(4.1V max).

    The final step is to save to EEPROM the frame count. After which, it will go into deep sleep. Instead of deep sleep, we just turn the GPS back on.

    Fixes #283, #265 and #272. By turning on the GPS as soon as a tx/rx is completed, we give the GPS as much time as possible to get a good fix.

    Wakeup GPS ONLY after a nvm store call (#309)

    Don't wakeup during a nvm restore call.

commit b608f98369f574cc17c96eeda2ea104ffc948b9c
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:54:36 2021 +0100

    Make better use of EEPROM space (#297)

    Now save 680 past positions, up from 360 positions. Starts EEPROM location for past data storage immediately after the area reserved for saving keys. Implements unit-tests to verify no overlap.

commit f78f8bd1705c45365366fe7ee9a62a16f3b8e683
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:15:43 2021 +0100

    fix refactor failure

commit 63ff8669133274d2f4a2be6bd56ea7d75c1f0b36
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 16:09:46 2021 +0100

    Print out past data better (#295)

    Print out past data in a human readable format

    clean up printout

commit e1239b910d9cb2e4aa07aa2c5da7fcae286ce272
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 15:54:36 2021 +0100

    Properly test encoding of gps position (#294)

    Code separates out the encode and decode functions for saving to EEPROM with fewest bytes and also for making telemetry as short as possible. Creates a few unit-tests to test the full range of expected values.

    fix test

commit 4688bd1db5c279e115d83decfbf83d28e41520a1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 02:33:21 2021 +0100

    ack successful credential change in EEPROM (#292)

    This commit adds a feature to set a bitfield in the telemetry that acks when EEPROM stored credentials have changed from an downlink from the ground. It does significant updates to structures, using fewer points, more atomicity. It adds in a number of unit tests as well, to ensure this change did not break things. The bit fields are combined with the other currently in the telemetry, Playback error. Combining all flags into one set of bit fields simplifies things. The bitfields take the place of the pressure telemetry field, which is no longer used.

    This commit also removes unused fields in the `sensor_t` struct that has to do with the GPS. GPS has a separate struct.

    undo field removal

    its still necessary

commit 769d8e09e37af51628072134528f6e1f8f7e7517
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 01:17:37 2021 +0100

    Remove redundent tests and allow compilation (#293)

    These tests test too many internal functions, that should not be exposed. Some of these features have been removed, such as OTAA. Also disable some internal function calls that are no longer exposed

commit 982fcc2daaa9c98e926caf7f6e4e79bfbdcf8e62
Author: MedadRufus <[email protected]>
Date:   Sat Oct 30 00:20:33 2021 +0100

    append _encoded to variables that are encoded

    Its confusing if encoded values are not explicitly labeled.

commit 33b7fee89863907280cb804e2dbd35bdd7239fad
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 01:39:39 2021 +0100

    Don't tx with wrong frequencies (#268)

    Add logic to prevent tracker from transmitting if its detected that the LoRaWAN stack has been not initialised to the right regional parameters. If its not been correctly initialized, just don't transmit. It will be initialized correctly later when switching device registrations.

    This code adds in a few unittests to test that.

commit 7049237b4d53a9cab4cfebad2243a81c1494c30f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 28 00:36:56 2021 +0100

    Allow unittests to compile (#288)

    I could not get unittests to compile because of changes to the app code. Now done a bunch of fixes and workarounds to at least compile. They don't pass though!

    * get tx permission

    * fix setting loramac region

    * use new function

    * mock disabling uart

    * allow compilation

    comment out stuff that won't let it compile

    Update app_ut.cpp

    * fix expected calls to gps info

commit 5747158c15da8829ce7ae90a7f632b10af3a8bd1
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 22:31:09 2021 +0100

    remove unused logic

commit be9e925e30e5bfb5dfe5040f33fb427c77e9d5f8
Author: MedadRufus <[email protected]>
Date:   Wed Oct 27 02:27:47 2021 +0100

    Fix unexpected watchdog resets in deep sleep (#286)

    Edits now ensure TimerStop(&TxTimer); and subsequently TimerStart(&TxTimer); is called before and after every transmission. However, when switching between end node registration keys, it will wait only 10 seconds(`TX_INTERVAL_GPS_FIX_NOT_OK`), whether it has GPS fix or not.

commit cc60506b429c39b3a46a1e5e8f6d0cb123d7f954
Author: MedadRufus <[email protected]>
Date:   Tue Oct 26 01:47:05 2021 +0100

    Fix adc reads (#200)

    Uses the implementation used in the old Picotracker Lora code to fix the adc read. It now works.

    Source adc code: https://github.com/ImperialSpaceSociety/picotracker-Lora

    fixes #31

commit d77c169cb3cf42b829cadca60ebb31723d387b2c
Author: MedadRufus <[email protected]>
Date:   Mon Oct 25 23:00:50 2021 +0100

    Setup rx1 delay to default 1 second (#284)

    fixes #259

    Manually, I have changed all the device registrations on the Things Network using the cli:
    ```
    ttn-lw-cli end-devices set --application-id "icss-lora-tracker" --device-id "icspace26-eu1-eu-863-870-device-5"  --mac-settings.desired-rx1-delay RX_DELAY_1 -c ttn-lw-cli.yml
    ```
    This commit also changes the generator when making future end node registrations on the things network.

    * update readme to show example for updating rx1 delay

    * update generator

commit 5599106d3f5d296c6915c7a6485fdd4406e5a2a4
Author: MedadRufus <[email protected]>
Date:   Fri Oct 22 17:23:55 2021 +0100

    remove dependency on extern variable call (#276)

    Not good practice to use extern call to variable. I use getters and setters instead

commit cccc932e9656fbc6d49a159bb241e67a20ea243f
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 02:49:09 2021 +0100

    do LBT in AS923 regions. (#275)

    This complies with Japanese rules. Doesn't hurt to enable it in other AS923 regions.

commit 800e7e647b0225298bc3e5ae9661031f0510b539
Author: MedadRufus <[email protected]>
Date:   Thu Oct 21 01:35:01 2021 +0100

    Put in decoder for helium network (#273)

    * Create uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

    * Update uplink_decoder_helium.js

commit 76416c1b54cc1c922b2844dc2e6830d67a524515
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:46:18 2021 +0100

    only require 4 sats for position solution (#270)

    Ensure shortest first time to fix

commit 82cbe894eb1819b0ed1e5cdc673818c9523b2162
Author: MedadRufus <[email protected]>
Date:   Tue Oct 19 02:07:11 2021 +0100

    Use eeprom update (#267)

    fixes #263.
    Only update changed bytes in eeprom, to reduce wear. This commit changes all remaining NvmmWrite() to NvmmUpdate().
    Reduces wear in EEPROM, especially in the bytes that rarely change.

    * only update changed bytes in eeprom
    * update test to nvmupdate

commit 7a7da29fdaf73041b1299bf44b76b6d083d80255
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 18:03:53 2021 +0100

    tx on ttn less frequently (#258)

    Transmit on helium network 4 times for every transmission on the Things Network.
    fixes #256

    * 4 helium tx for 1 ttn tx in Europe

    * configure US

    * put in russia keys

    * loop through all the helium credentials for CN, IN, AU

    * repeating done for AU and CN and IN

    * put in repeat keys for AS and KR

commit f1100436ee7d6c6c862061b3d0663a6ba34cca59
Author: MedadRufus <[email protected]>
Date:   Sat Oct 16 01:34:36 2021 +0100

    Tx with new gps fix each time (#262)

    This commit significantly simplifies the code in `main.c`. Then makes it get a GPS fix with every single transmission. The interval between transmissions are set depending whether a GPS fix was successful or not. If not successful, resume search in 10 seconds. Otherwise, resume search in 20 seconds.

    The code currently does not have much tests for this features.
    A number of functions that are not essential to be viewed in `main.c` have been moved to `callback.c`. `main.c` has been stripped down as far as possible to the core logic, to make reviewing easier.

    * put guard

    * clean up functions

    revert move of print_board_info()

    * move function

    * move print function

    * print board info in seperate file

    * move struct declaration to top of file

    * use pointer

    * move buffer fill to another file

    * move board setup to seperate file

    * change order

    * refactor name of function for readablity

    * static internal functions

    * move constants to config file

    * use more descriptive function name

    * move OnRxData() to second file

    * remove unused imports

    * refactor name of function

    * do join as expected

    we are in abp mode so it will pass it

    * set tx interval depending on fix status

    * don't start timers for tx outside the txprepare function

    * remove redundant code

    * update comment

    * remove unused code

    * remove redundent variable and declaration

    * clean up order

    * use #defines to set tx intervals

    Update config.h

commit 4250bed1e178a06dc0a217a480540872d2c6be1a
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 20:04:29 2021 +0100

    reset watchdog only during anticipated events (#260)

    * dont reset watchdog in main loop

    Only do it during events

    * make the watchdog kick in shorter

    * watchdog reset after send

commit 556d513c2f201a4387cd22c964fe98001515bab3
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:58:51 2021 +0100

    Disable uart output to reduce peak currents (#257)

    fixes #241
    * disable serial output with #define

    * put in warning

commit 4adf4f0a9aa6ffefd3a48ada0aec3d219263db3c
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 01:28:14 2021 +0100

    put in util scripts to generate instructions for polling specific time intervals

commit b1aaf0cf3db51301ace87fbb10f5db3021120f48
Merge: 444c0aad 12bec9d1
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:59:02 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 444c0aada73de83b2db71589b3f5d440a369f842
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:58:58 2021 +0100

    Create uplink_decoder_ttn.js

commit 12bec9d1a60730001453114e8d15ed84357be52f
Author: MedadRufus <[email protected]>
Date:   Fri Oct 15 00:38:00 2021 +0100

    Make watchdog catch timer failures (#255)

    In the event the wakeup timer for the next event is NOT set, it could be in deep sleep forever, kicking the watchdog timer as designed. The watchdog should instead reset when the next expected event(e.g. transmit) does not happen.

    So just remove this watchdog kick timer. Its a weak point.

    But as a compromise, the longest sleep delay is 32 seconds. This lenght of time is the longest possible watchdog reset interval. So we schedule transmissions to happen every 31 seconds, down from 60 seconds.

    * watchdog reset IMMEDIATELY after wakeup

    * reduce tx interval down to 31 seconds

    So that the watchdog won't kickin before that

commit 6c6af3fb5db732f2e823d8585d7a6977872f7f8e
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 23:24:03 2021 +0100

    Send keys in uplink (#250)

    Creates a feature to send up a new set of keys fore each registered device. In case the keys expire, we can send them up via the other network. Either the Things Network or Helium Network.

    * put in function to update credentials in EEPROM

    * put in structure for updating keys

    * fix

    * use our new function to update keys

    * import dependency

    * do set the keys from the data in the uplink

    * only update network keys in EEPROM

    * do check to see if CRC fails

    * read bytes from EEPROM or restore from default

    Restore from default if EEPROM is corrupted.

    * make function to save to eeprom with crc

    * clean up for readablity

    * put in pointer fix

    * update tests for new credentials

    * update comments

    * expose OnRxData() for testing

    * create test to manange downlink

    * make test

    * update test

    * fix pointer error

    * use defines

    * rearrange order of struct

    and somehow, it works

    * update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

commit 58e048dbc73f33a31cfcc2f099b1009946a44052
Author: MedadRufus <[email protected]>
Date:   Thu Oct 14 04:15:42 2021 +0100

    update tests for new credentials (#251)

    new credentials were added so update tests

    update tests for new credentials

    update comments

commit 2e20940d9b629ab3f74d596a972612eafd2a6c9b
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:35:18 2021 +0100

    Loop through more unique helium device registrations (#248)

    Loop more through more credentials. This allows future changes to the credentials, while still looping through multiple devices. For example, if we in the future register the device on an another network(that is built in the future), we can send those new credentials to the tracker to occupy these slots. We can still loop through the current existing registrations as well.

    * loop through more helium credentials

    * more looping

commit 3ae49de42b91a375de8731e44e453127094e5e18
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:25:38 2021 +0100

    put in korean TTN credentials on AU1 server (#247)

    add in credential for the AU1 server in addition to EU1. fixes #220

commit 24655a678a0244eab267ef03bdaa1d2cb6545e12
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:24:32 2021 +0100

    Revert "put in korean TTN credentials on AU1 server"

    This reverts commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2.

commit 79f0c9eb6c5dd6adde3f196545cf76b0bd65cdf2
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 23:20:13 2021 +0100

    put in korean TTN credentials on AU1 server

commit b53f73603425dcb19097b3c0c519183ab6f136e9
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 22:43:19 2021 +0100

    Add in multiple device registrations to reduce fcount increments (#244)

    In order to reduce the rate of frame count increase for devices,  register multiple devices, and cycle through all of them, incrementing the frame count for each device one by one. This will reduce the rate of frame count increase, so that server and end node frame count does not diverge more than 2^14. See #210 for more info on the problem this commit solves.

    * add in structures for helium network credentials

    * put in the remaining credentials for helium 2-5

    * put in 5 more device registrations

    * number the devices

    * update eu keys to use the multiple helium devices

    * put in credentials for helium 6-10

    * put in new key for helium 1

    it was not working earlier for some reason

    * put in new eu keys

    * put in structures

    * put in more devices

    * updates keys for the other registered devices ttn

    * use a common frame count start for each network

    * put in structure for us keys

    * update keys for us915

    * update comment

    * put in basic sanity size check

    * put device list for US

    * make tests compile

    They don't pass though

    Update lorawan_credentials_ut.cpp

    * spread device frame count usage

    * alternate helium keys over russia

    * use better order over Japan

    * update bug discription comment

    * update comment

commit 341a53a261e98e971cc989e9f76ce23f0fa5f62f
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 19:26:06 2021 +0100

    tx twice with same position data (#246)

    Instead of 3 tx in a row with same data, do it twice. We need at least 2 tx in a row in order to ack any downlink. The ack comes in the second message

commit 28c0c521ab5f3973f9064507016add49cc6714e0
Author: MedadRufus <[email protected]>
Date:   Wed Oct 13 04:27:21 2021 +0100

    use a single variable for FNwkSIntKey, SNwkSIntKey, NwkSEncKey (#245)

    They are all the same. use a single variable to save on memory and EEPROM space, and also reduce errors in programming.

commit 24f0987be1ccfbcb44a5883471c0ebb1fa4c9c4b
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 02:57:44 2021 +0100

    Update geofence for remote locations (#240)

    Updates geofence to work in the Falkland islands, Antartica, Ascention islands and north atlantic british territories, Guam.
    Backed by unittests for all these locations.

    * do tests for the british territories in the Atlantic

    * verify that tx ok is correctly set

    * put intests for a few more remote places

    * put in antartica positions

    There was one helium gateway there!!

    Update geofence_ut.cpp

    * put in geofence maker

    * Create geofence.kml

    * Update [WORKS]geofence maker Google Earth.py

    * put in test for Newzealand

    * eu868 on Heard_and_McDonald_Islands

    The gateway owner has other gateways based in the UK. So likely an EU868 helium gateway

    ]* Update geofence.kml

    * update fences

    Adds in a polygon to cover Guam and the western pacific. Also adds in an Antartica polygon, transmitting on US915.

commit f065a3d0e0be99395e9df1ebc7ee2be6d26235af
Author: MedadRufus <[email protected]>
Date:   Tue Oct 12 00:15:22 2021 +0100

    Clean up geofence tests (#239)

    Important changes:
    * use RU868 frequencies over russia. It was formerly using EU868 frequencies
    * move all internal variables into module

    Don't expose them outside

    * remove tests that check internal functions. Should not touch it

    * only test the external API of geofence

    * in Australia, use AU915 frequencies

commit ae7d3100ae9be55c0d5b7c9bf26e64867db6d537
Merge: 3a4a44ef 608b6775
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:26 2021 +0100

    Merge branch 'icspace-dev' of github.com:ImperialSpaceSociety/LoRaMac-node into icspace-dev

commit 3a4a44efd0558bff6da5cd80e070e963aab77659
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:27:15 2021 +0100

    use the default lorawan RX2 datarate

    At least when autogenerating the end node regististration.
    fixes #224

commit 608b67755e141f7f4d922446b4c95280c2379d6f
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:17:34 2021 +0100

    change remaining NvmmWrite to NvmmUpdate (#237)

    fixes #237

commit 79c0449f41c1c76bf68dbdf5bc32ebabdb740528
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:12:28 2021 +0100

    Save rx2 delay to eeprom (#232)

    Fixes #215 and  Fixes #235 at the same time.

    Adds in unittests to test the rx2 persistance, and also the frame count.

commit 0aa0882b050a523c28940325825dc70f0624fa72
Author: MedadRufus <[email protected]>
Date:   Mon Oct 11 23:08:30 2021 +0100

    fix tests for config switcher

commit 2652038fa73880fe9e69c40670dcbfcd63a75267
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 19:20:29 2021 +0100

    autoformat ONLY

    Use the default format on VScode

commit 79e791bbeb45c92284781623c1d6450f28a2f4f3
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 18:49:55 2021 +0100

    Save seperate fcount to EEPROM for each end node (#227)

    Its necessary to track the frame count for each registered device seperately so that there is a low risk of the end-node frame count and server frame count diverging by more than 16384 counts. If it diverges so far, the LoRaWAN server must reject all future frames, a big issue.

    fixes #225
    prepares for #210 workaround, using many registered devices to ensure frame count increments more slowly.

    * remove all tests for storing NVM for OTAA

    We don't use OTAA anymore.

    * start eeprom with all zeros

    As if it were a brand new device

    * Check array with MEMCMP_EQUAL

    * clean up implementation of test

    Remove unused test redundent

    * reorganise network keys into a list

    Its easier to maintain.

    * add frame count to each device keys

    * put in crc also

    * expose registered devices

    Update LoRaWAN_config_switcher.h

    * use enum to select the network keys

    simplifies it

    * put in strategy

    * get the current network for usage elsewhere

    * fix order

    * remove duplicate

    * no need to pass region

    * remove all unused imports

    * implement frame count storing/restoring to EEPROM

    remove unused structs

    * just set the correct network keys and frame count

    * cast correctly

    * no need to set the datarate here

    * don't set dev_address here

    Do it in the nvm restore

    * remove unused imports

    * don't use soft-se workaround

    Do all the overriding in the nvm management file

    * don't externally access the soft se

    * set the sercure element

    * set devaddr

    * return bytes written/read

    * remove redundent test

    * put back datarate setting

    This is a workaround to ensure first tx after boot does not send with empty frame

    * set the default datarate always

    * update byte instead of 4 bytes

    The 4 byte write, while faster, is not properly tested

    * formatting only

    * updatebytes instead of writing everytime

    * use correct size types

    * remove redundent tests

    we only restore the keys after nvm has been setup.
    make more realistic tests

    * put in test to verify eeprom

    * use correct function arguement

    * make test do as expected

    * check specific bytes in eeprom

    * update comments

    * fix arguments

    * refactor with better name

commit ce9af2d8caa04860cc597699d495a1407187e5bf
Author: MedadRufus <[email protected]>
Date:   Sat Oct 9 17:45:11 2021 +0100

    Just make gps buffer dynamic and larger (#230)

    fixes #228
    Sometimes, the buffer for receiving data from GPS overflows, because too much data is scheduled. So just dynamically allocate the memory on heap, and receive it, then destroy after function completion.

commit 3c39de5a0834cd33f01bd746e6ff23d765384c36
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:38:08 2021 +0100

    prevent GPS altitude rollover

    Casting from signed to unsigned will cause unexpected rollover if the signed value was below zero.

commit bc7777b320535fb7f424ec3e3692f01a805d81ac
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 23:08:03 2021 +0100

    increment fcount in eeprom/locally during init (#223)

    Ensures that fcount is always incremented between transmission.
    fixes #222

commit c321014eea59caa8f5b4bce9dd0ead27220f5630
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 22:22:43 2021 +0100

    init the playback BEFORE turning on GPS (#221)

    It spends 50 milliseconds or so printing out past positions. Ensure this happens when only the MCU is on, not when both MCU and GPS is on.

    Likely fixes #186

commit 1958a3eaed27e92f2035f9a591aed631522ccaf1
Author: MedadRufus <[email protected]>
Date:   Thu Oct 7 16:44:36 2021 +0100

    Cycle through list of credentials in each country (#219)

    This is one workaround for #218. In Japan, it cycles through device credentials registered on the EU1 cluster and the AU1 Things Network cluster(and the Helium network). I am hoping all gateways in Japan will be on either the EU1 or AU1.

    Code also registers devices on US1 for US credentials, and AU1 for Australian credentials. CN, IN, KR, RU, EU remain on EU1 cluster.

commit f67500552442c5e52e37588fb745c62d59caa32e
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:47:22 2021 +0100

    explicitly use DR4 over US

commit e768a6c405581bde1c662d38b5f37dab974164b1
Author: MedadRufus <[email protected]>
Date:   Sat Oct 2 02:43:38 2021 +0100

    Join ahead of launch (#209)

    Simply switch to using ABP for both Things Network and Helium Network. On The Helium network, it can only use OTAA, but we hardcode in the DevAddr, AppEUI, NwkSKey and AppSKey and make it join with ABP activation. It works.

    Implements a counter in EEPROM to ensure frame count always increments.

    This commit removes all the functionality to save the whole LoRaMAC state, including the complex compression. Only thing that is saved is frame counter, one for each network.

    TODO: make frame counter saving more robust.

    autoformat

commit 4027ac1ab855e449acf87140728d7d4d30bd71b3
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 17:43:50 2021 +0100

    Update README.md

commit 6a80ec4f54d6c0ed227793bb198e1c3943749999
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:53:51 2021 +0100

    put in gpio mock file

    Because it is used once in the application code

commit c3397307420ba12f939f726584310f0034143330
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:35:52 2021 +0100

    use relative path for executable (#204)

    * use relative path for executable

    * fix order and add end of line

commit c3eefe9a0cbd9b223c1813b54b925d49571e0da6
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 16:32:24 2021 +0100

    Update instructions for running unittests

    Update README.md

commit 01397aebf719c9415aa0e217b5a98cd9d9116da2
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 14:07:36 2021 +0100

    Update README.md

commit 19d9dd82c10eefab32277ad63fd7b5931415394f
Author: MedadRufus <[email protected]>
Date:   Tue Sep 28 00:23:57 2021 +0100

    Disable brownout detect (#187)

    Just allow it to operate to its lowest possible voltage level, of 1.45 V-1.55 V.

commit 03bd18654d4a1aaeabc0a89e207fae2c4c8a5a45
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:44:46 2021 +0100

    set tx interval to 60 seconds everywhere around world

    Just keep it consitant. Fixes #167

commit 3ea60a49e14005784303ce6198f490fe6268cca7
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 23:26:10 2021 +0100

    Generate script for generating ttn cli commands for all end nodes (#199)

    * Create ttn_cli_commands_generator.py

    * remove redundent stuff

    * add options for fcount and decice status request priodicity

    * Update README.md

    * print fcount commands

    * Update ttn_cli_commands_generator.py

commit c2aa03c8b938a5ad8e96e228a1772870581b07e1
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 22:37:03 2021 +0100

    Update README.md

commit 1ab4fa5fbcf2c56b8769e4956ffb0cc2013cc3bb
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 20:52:20 2021 +0100

     put in instructions for TTN configuration

    Useful for using the command line interface

    Create ttn-lw-cli.yml

commit 60eb2633f9b487ee7a3e854942e968c71d0154a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:46:55 2021 +0100

    Search for gps fix immediately after tx if no fix (#195)

    It waits 10 seconds after the transmission(allowing for rx1 and rx2 to complete) before it goes back to searching for GPS fix. This is done to make it not wait before searching for the next fix if it did not have a fix already

commit 2ec5fe94261424ade95ea962be33d147b779e337
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 18:01:11 2021 +0100

    do only one transmission if no GPS fix (#191)

    If no fix was acquired, then search for fix immediately after the first transmission. Otherwise, get a gps fix after 3 transmissions. 3 successive transmission(actually 2) are required to receive any downlinks from ground.

commit dd529ded809168b7ccfe04f1a91f8d416c39dc2a
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:55:47 2021 +0100

    timer stop during callback (#194)

    Thats how its done else where so keep consistancy

commit 3af14d5fdaf84c329b3eea069d6da1bd02b4c81c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:53:59 2021 +0100

    use slightly larger i2c buffer for ublox (#193)

    There is a possiblity that NMEA data could be larger. Its around 220 bytes for nema data, but keep a larger margin.

commit 29918080070f5dea9d133a1fa97dd49493c961bd
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 17:51:44 2021 +0100

    Revert "increase buffer to receive nmea data from ublox"

    This reverts commit 326315795c4f96bce63109e966fe331343d5f6a6.

commit 326315795c4f96bce63109e966fe331343d5f6a6
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 00:47:41 2021 +0100

    increase buffer to receive nmea data from ublox

    Sometimes, it can overflow, so increase the buffer

commit a837242b710c17db206352d71f632869b272e40c
Author: MedadRufus <[email protected]>
Date:   Mon Sep 27 15:15:28 2021 +0100

    use consts to reduce ram usage (#192)

    Setting all the geofence boundaries and network keys for each region to consts immediately reduces the .data section from over 4000 bytes to 1368 bytes

commit dccf2775c5768306614382ad9d14699e7d7130e5
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:42:47 2021 +0100

    update documentation link for GPS firmware update

commit 4d5aa762bb104b64d35de4b6ab461a9652623f73
Author: MedadRufus <[email protected]>
Date:   Sat Sep 25 11:28:51 2021 +0100

    Optimise gps driver code for low peak currents (#188)

    Rewrites to the Ublox GPS driver code to ensure it does go into low power. Verified with a power analyser. Peak currents are 40 mA when both processor and GPS is on. Currently, max duration in this 40 mA state is 50 milliseconds. Other peaks are shorter, less than 10 ms when sending and receiving data from GPS. Otherwise, the peak current is 25 mA.

    The code has also been stripped of all unnecessary functions to make it cleaner.

commit 33093756ef4ed6dc32101325efa3e5b2009bcc49
Author: MedadRufus <[email protected]>
D…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant