init

Dependencies:   aconno_I2C Lis2dh12 WatchdogTimer

Revision:
11:60eb0ff945f2
Parent:
10:c8798fd9773b
Child:
12:8345612bf867
--- a/main.cpp	Sat Dec 15 14:33:59 2018 +0000
+++ b/main.cpp	Sat Dec 15 20:09:19 2018 +0000
@@ -68,10 +68,11 @@
 //------------------------------------------------------------------------------ 
 //BLE myble;
 WatchdogTimer watchdog(65.0); //Do not set to less than 4500ms or can cause issues with softdevice
-#if NEED_CONSOLE_OUTPUT
-Serial uart(PN_UART_TX, PN_UART_RX, 115200);
+//SERIAL DEBUG?
+#if CONSOLE_DEBUG
+    Serial uart(PN_UART_TX, PN_UART_RX, 115200);
 #endif
-
+        
 //------------------------------------------------------------------------------
 //TIMERS
 //------------------------------------------------------------------------------ 
@@ -332,6 +333,14 @@
         if (RET_coldBoot != 1) gotoSleep(30000); //THIS HAS TO BE THE FIRST ITEM IN THE MAIN LOOP
         watchdog.kick();
         
+        Filesystem filesystem(PN_SPI_MOSI,PN_SPI_MISO,PN_SPI_CLK,PN_SPI_CS1);
+        
+        //GET TEMPERATURE
+        SI7060 temperature(PN_I2C_SDA,PN_I2C_SCL);
+        float temperature_c = temperature.getTemperature();
+        DEBUG("temp: %f \n", temperature_c);
+        filesystem.addLogEntry_temperature(RET_RTCunixtime, 10.5);
+        
         //MAIN LOGIC
         DEBUG("mode: %i  time: %i, %i, %i, %i \n", RET_mode, RET_RTCmicros, RET_RTCunixtime, RET_buttonHoldTime, RET_buttonPressCount);
         mainStateEngine();