Code changes

 Another change inspired by the Pi Wars conference was re-examining my use of threads.

Let me add some more background. The pymesh lora mesh networking feature built into these devices and their corresponding pycom gateway is brilliant. It essentially nulls out the need for dedicated gateways to use lora to extend coverage beyond NB-IOT and wifi range. However, the catch was that whenever I enabled this feature performance slowed to a crawl. Evidently it was using a fair bit of processor grunt. it was probably using a fair bit of extra power too (I'll measure it at some point). The later I'm not worries about, battery life is already way above spec, but all that processor usage slowed the speed of reading and sending NFC data, and that was not good.

The solution? Make my code run faster, and reduce processor usage. Easiest solution was I was running a thread that was not required. On the old code-

  1. Script started and did a lot of setting up
  2. Thread 1 started for NFC reading, time stamping and storing
  3. Thread 2 started for transmission
So the original script just sat there. The new code-
  1. Script starts, does a lot of setting up then starts NFC scanning
  2. Thread 1 starts for transmission
I've also adjusted the code so the data will not transmit if the device is not connected, either standalone or via pymesh.

And now I've just remembered I need to add that to the "power on" message....

In other news I changed the setup of the test kit a bit to better represent the real life setup. However - that will change soon when I get the new custom PCB + adafruit PN532 running!

In the meantime, I'm toying with a Patreon account. However, I'm not sure really what I can offer that's "exclusive" for a completely open source project. Any thoughts please let me know.