Another thing that might have caused problems was the DMA mode used for the display. I decided to turn it off in the end, after realizing it doesn't really play well with other devices on the SPI bus. The sources mentioned something like that the DMA can stall other devices. What I noticed was more like the opposite - clearing the screen took 29ms with DMA enabled before other devices were activated, but a few seconds in the main program loop where other devices were talked to!
I changed the sensor node code to be more similar to the sample code I already wrote. Resulting code uses just pure RF24 radio without the RF24Network extension, runs on 250kbps for longer range, and does not use any acks. I might change it in the future after doing some tests. The sensor node also uses EEPROM and simplified identification in form of two characters, like 'T0' for first temperature sensor etc. The packet that temperature sensors send looks like this:
typedef struct PACKED {
uint8_t PacketType;
uint8_t BattLevel;
uint16_t Flags;
uint16_t SensorId;
uint16_t Temperature[2]; // Up to two temperatures in tenths of degrees.
} SensorPayloadTemperature_t;
To recap, I am planning four types of nodes:
- Central node - Arduino Due, has Internet access and serves as a central hub
- Network nodes - support RF24Network (maybe with Mesh extension), typically used for bigger tasks with a lot of communication happening
- Broadcast receivers (consumers) - RF24 radio only, receiving broadcast info from Central node but do not send anything back. Typically clocks etc. Broadcast receivers have no ID
- Sensors - RF24 radio only, sending data to Central node, not receiving anything. Have simple two char ID to distinguish between multiple sensors of one type
Last but not least. After finishing the Friday's entry, I finally had chance to try my new telescope out. It probably needs some adjusting, but I was able to identify that bright planet I was seeing from my window every evening. It's Jupiter, and I can confirm it as I saw its moons - for the first time in my life! It left me in awe, and Jupiter is no more just a word, but something that physically exists for me.
Žádné komentáře:
Okomentovat