attempt to fix posible power issues with the sharp
Dependencies: ADS1115 BME280 CronoDot SDFileSystem mbed
Fork of Outdoor_UPAS_v1_2_Tboard by
Diff: main.cpp
- Revision:
- 26:6aa294d83af4
- Parent:
- 25:fbf7d44e7da4
- Child:
- 27:922f53fa649c
--- a/main.cpp Wed Apr 20 03:36:48 2016 +0000 +++ b/main.cpp Wed Apr 20 16:47:28 2016 +0000 @@ -179,10 +179,10 @@ char gpslon = 'N'; -float home_lat = 40.580508; -float home_lon = -105.081823; -float work_lat = 40.594062; //40.569136; -float work_lon = -105.075683; //-105.081966; +float home_lat = 40.00000; //40.580508; +float home_lon = -105.000000; //-105.081823; +float work_lat = 40.100000; //40.594062; //40.569136; +float work_lon = -105.100000; //-105.075683; //-105.081966; int location = 0; float homeDistance = 99999; @@ -600,7 +600,7 @@ if(bVolt > 1750 && amps > 8191) { - RGB_LED.set_led(0,1,0); + RGB_LED.set_led(0,1,0); } else if(amps > 8191 && (RTC_UPAS.hour >=20 || bVolt < 1500)) { if(ledOn) { RGB_LED.set_led(0,0,0); @@ -717,11 +717,10 @@ pc.printf("\f\n\r-------------Startup-------------\n\r"); wait(0.5); - - uint8_t serialNumberAndType[6] = {0x50,0x53,}; + uint8_t serialNumberAndType[6] = {0x50,0x53,}; //ex) PS0018 // 0x50,0x53 <- ASCII 80 + 83 (PS) //0x4d,0x53 <- ASCII + 83 (MS) E2PROM.read(0x00034,serialNumberAndType+2,2); - + int tempSerialNum = serialNumberAndType[2]+serialNumberAndType[3]; int serialNumDigits[4]; serialNumDigits[0] = tempSerialNum / 1000 % 10; @@ -734,6 +733,7 @@ serialNumberAndType[4] = serialNumDigits[2]+48; serialNumberAndType[5] = serialNumDigits[3]+48; + RGB_LED.set_led(0,1,0); pc.attach(pc_recv); @@ -753,7 +753,7 @@ RGB_LED.set_led(1,1,1); while(runReady!=1) { wait(1); - pc.printf("Waiting for BLE instruction"); + pc.printf("Waiting for BLE instruction\r\n"); } @@ -761,6 +761,31 @@ E2PROM.read(0x00015, startAndEndTime, 12); //Grab start and end times from EEPROM RGB_LED.set_led(0,1,0); + + //Pull MicroEnviornment Lat/Lons from EEPROM + // Latitude School EEPROM = 0x50-0x53 + // Longitude School EEPROM = 0x54-0x57 + // Latitude Home EEPROM = 0x58-0x5B + // Longitude Home EEPROM = 0x5C-0x5F + + uint8_t workLat[4] = {0,}; + E2PROM.read(0x00050,workLat,4); + E2PROM.byteToFloat(workLat, &work_lat); + + uint8_t workLon[4] = {0,}; + E2PROM.read(0x00054,workLon,4); + E2PROM.byteToFloat(workLon, &work_lon); + + uint8_t homeLat[4] = {0,}; + E2PROM.read(0x00058,homeLat,4); + E2PROM.byteToFloat(homeLat, &home_lat); + + uint8_t homeLon[4] = {0,}; + E2PROM.read(0x0005C,homeLon,4); + E2PROM.byteToFloat(homeLon, &home_lon); + + pc.printf("%f,%f\r\n%f,%f\r\n", home_lat, home_lon, work_lat, work_lon); + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //UPDATE THIS TO WORK WITH ST RTC INSTEAD //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!