3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
Diff: main.cpp
- Revision:
- 37:00775e368a71
- Parent:
- 36:19d3f752f9c3
- Child:
- 38:e626a358e5e3
--- a/main.cpp Wed Apr 05 13:33:32 2017 +0000 +++ b/main.cpp Wed Apr 05 13:50:55 2017 +0000 @@ -20,8 +20,8 @@ //Threads -Thread *t1; -Thread *t2; +Thread *produceThread; +Thread *measureThread; int count= 0; //Class type class Measure { @@ -43,7 +43,7 @@ // Call this on precise intervals -void DoMeasure() { +void MeasureThread() { while(true) { @@ -86,7 +86,7 @@ } //Normal priority thread (consumer) -void thread1() +void ProducerThread() { while (true) { //Block on the queue @@ -111,7 +111,7 @@ } void SendSignalDoMeasure() { - t2->signal_set(SIGNAL_doMeasure); + measureThread->signal_set(SIGNAL_doMeasure); } // Main thread @@ -120,27 +120,27 @@ measurer.init(); measurer.calib(); //Start message - printf("Welcome\n"); + printf("Welcome\r\n"); //Hook up timer interrupt Ticker timer; timer.attach(&SendSignalDoMeasure, 5.0); //Threads - t1 = new Thread(); - t1->start(thread1); - t2 = new Thread(); - t2->start(DoMeasure); + produceThread = new Thread(); + produceThread->start(ProducerThread); + measureThread = new Thread(); + measureThread->start(MeasureThread); printf("Main Thread\n"); while(1) { Thread::wait(3000); - float temp,humi; - measurer.ReadTempHumi(&temp, &humi); - barometer.get(); + // float temp,humi; + // measurer.ReadTempHumi(&temp, &humi); + // barometer.get(); // t2->signal_set(SIGNAL_doMeasure); - printf("Main Thread Measures: %fC %f %f \r\n", temp, humi,barometer.pressure()); + // printf("Main Thread Measures: %fC %f %f \r\n", temp, humi,barometer.pressure()); } }