spacecraft-design-lab-2019 / documentation

Wiki lives in here
https://github.com/spacecraft-design-lab-2019/documentation/wiki
12 stars 3 forks source link

Ridge Test Code Improvements + Tips #195

Open maholli opened 4 years ago

maholli commented 4 years ago

The original code puts a sleep here: https://github.com/spacecraft-design-lab-2019/Comms/blob/d136f4872d82fe784bcf1ba31aeef4378b22fc77/2-17%20Ridge%20Test/ridgeRx.py#L65 which is actually counter productive. Instead, structure the loop like this:

   if packet is None:
      pass
   else:

now to make packet checker to be more robust, let's just save the packet data to an SD card and check it afterwards. I wrote a quick "helper" library to make it easier for me to access the radio and SD card. It's modeled after my pycubed.py library and could certainly use improving!

(download and rename pycubedmini.py.txt to pycubedmini.py and place it in the \lib\ folder on the motherboard.

pycubedmini.py.txt

RX code:

from pycubedmini import pocketqube
import time
pocketqube.unique_file

cnt=0
while True:
    packet = pocketqube.radio1.receive() 
    if packet is None:
        pass
    else:
        cnt+=1
        if cnt>100:
            break
        rssi = pocketqube.radio1.rssi
        print((cnt,time.monotonic(),packet,rssi))
        pocketqube.save(([cnt,time.monotonic(),packet,rssi]))