Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed WDT MODSERIAL BME280
Revision 43:358e853ba2c9, committed 2017-10-06
- Comitter:
- MAA
- Date:
- Fri Oct 06 13:05:07 2017 +0000
- Branch:
- MbedBMAGThrRev
- Parent:
- 42:0f34fa0c539e
- Child:
- 44:14ec59d2170c
- Commit message:
- PTH debug output added
Changed in this revision
| ErrorHandler/ErrorHandler.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ErrorHandler/ErrorHandler.cpp Mon Oct 02 10:56:55 2017 +0000
+++ b/ErrorHandler/ErrorHandler.cpp Fri Oct 06 13:05:07 2017 +0000
@@ -81,7 +81,7 @@
case(NO_FIX):
errorStr1.assign("SetClock");
- errorStr2.assign("!on mag");
+ errorStr2.assign("!on mag ");
if(magPromptCounter <= 30){
magPromptCounter += 1;
--- a/main.cpp Mon Oct 02 10:56:55 2017 +0000
+++ b/main.cpp Fri Oct 06 13:05:07 2017 +0000
@@ -10,7 +10,7 @@
#define BATTERYLOWLIMIT 10.5
//change BARCODE string inside double quotes to barcode of BMAG equipment
-char BARCODE[6] = "06655";
+char BARCODE[6] = "00000";
//Global GPS variables
Timer t;
@@ -47,6 +47,7 @@
char interpreterTmpID[10];
//global system variables
+bool detachMag = false;
bool tickerUpdated = false;
bool gpsRunning = false;
bool gpsCheckedAfter10Sec = false;
@@ -198,7 +199,8 @@
minutes = 0;
}
if(hours == 24){
- hours = 0;
+ hours = 0;
+ //prompt for date change when this happens.
}
}
@@ -208,6 +210,14 @@
pps_Tick();
}
+//bmag interrupt enable
+void bmagSerialInterruptEnable(void){
+ //BMAG communication init
+ bmag.baud(115200);
+ bmag.attach(&bmagrxCallback, MODSERIAL::RxIrq);
+ detachMag = true;
+}
+
int main(void){
//init pps timing variables
seconds = 0;
@@ -322,10 +332,6 @@
thr_writelines.start(write_lines);
wait_ms(1000);
- //BMAG communication init
- bmag.baud(115200);
- bmag.attach(&bmagrxCallback, MODSERIAL::RxIrq);
-
dbg.printf("Init.... Done!\r\n");
//init interpreterid
@@ -353,6 +359,10 @@
Ticker stateTicker;
stateTicker.attach(&setCheckStateFlag, 1.0);
+ //init ticker for bmag interrupt enable timing
+ Ticker magTicker;
+ magTicker.attach(&bmagSerialInterruptEnable, 30.0);
+
//BME280 pth ticker
Ticker PTHTicker;
PTHTicker.attach(&getPthValues, 11.0);
@@ -371,6 +381,11 @@
//infinite loop running after initialization
while(run) {
+ //disable continuous magtick detach
+ if(detachMag){
+ magTicker.detach();
+ detachMag = false;
+ }
//display txt on disp
if(dispFlag){
@@ -883,7 +898,9 @@
if(PTH_Humidity >= 100){
snprintf(HumidityArr, 10, "%.0f", PTH_Humidity);
- }
+ }
+
+ dbg.printf("P = %s, T = %s, H = %s\r\n",PreassureArr,TemperatureArr, HumidityArr);
PTHValuesReadyFlag = false;