Version 8, working version with Alix, sams and ollies code. Displays time, date and sensor info onto terminal, LCD and networking, and saves onto SD card.
Dependencies: BMP280 ELEC350-Practicals-FZ429 TextLCD BME280 ntp-client
Diff: main.cpp
- Revision:
- 12:4c7eaac8ceef
- Parent:
- 10:eea19f8e6122
--- a/main.cpp Thu Dec 13 15:46:07 2018 +0000 +++ b/main.cpp Mon Dec 31 19:20:22 2018 +0000 @@ -3,11 +3,14 @@ #include "sample_hardware.hpp" #include "Sampler.hpp" #include "SwitchManager.hpp" +#include "SDcard.hpp" void LCD_Thread(void); void SAMP_Thread(void); void SERIAL_Thread(void); void Network_Thread(void); +void SD_Thread(void); + Thread tLCD, tSAMP, tSERIAL, tSD, tNET; @@ -16,10 +19,11 @@ int main() { - tLCD.start(LCD_Thread); - tSAMP.start(SAMP_Thread); - tSERIAL.start(SERIAL_Thread); - tNET.start(Network_Thread); + tLCD.start(LCD_Thread); //start the LCD thread + tSAMP.start(SAMP_Thread); //start the sampling thread + tSERIAL.start(SERIAL_Thread); //start the serial communications thread + tNET.start(Network_Thread); //start the networking thread + tSD.start(SD_Thread); //start the SD card thread Thread::wait(osWaitForever); } @@ -74,12 +78,30 @@ } +void SD_Thread() +{ + while(1) + { + m_oSD.SDcard_Queue.call_every(5000, &m_oSD, &SDcard::Save_Data); + m_oSD.SDcard_Queue.dispatch(); + while(true) + { // Flash if the event queue is exited. + greenLED = 1; + wait(0.5); + greenLED = 0; + wait(0.1); + } + } +} + + + void Network_Thread() { while(1) { - m_oNet.Network_Queue.call_every(10, &m_oNet, &Network::NetPush); + m_oNet.Network_Queue.call_every(5000, &m_oNet, &Network::NetPush); m_oNet.Network_Queue.dispatch(); while(true)