Demonstration for connecting Multitech mDot/mDotbox to the Telit devicewise platform.

Dependencies:   DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B mDot_X_NUCLEO_IKS01A1 libmDot-mbed5

Files at this revision

API Documentation at this revision

Comitter:
pferland
Date:
Tue May 16 16:45:05 2017 +0000
Parent:
1:de9172a990bd
Commit message:
Corrected missing loop delay

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue May 16 15:08:16 2017 +0000
+++ b/main.cpp	Tue May 16 16:45:05 2017 +0000
@@ -1026,85 +1026,92 @@
             }
             */
 
-            //---------------------------------------------------------------------------
-            // Byte Vector Format:  More Data Payload, Less Human Readible
-            //---------------------------------------------------------------------------
+            if( cycle_cnt > 30 )
+            {              
+                sprintf(txtstr,"Transmitting... ");
+                if( bHasLCD ) evbLCD->writeText(0,7,font_6x8,txtstr,strlen(txtstr));
 
-            if(!bHasLCD && bHasACC)
-            {
 
-                sprintf(sensor_text, "ax:%d,ay:%d,az:%d,gx:%d,gy:%d,gz:%d,mx:%d,my:%d,mz:%d,p:%s,t:%s,h:%s",
-                    accel_vector[0],
-                    accel_vector[1],
-                    accel_vector[2],
-                    gyro_vector[0],
-                    gyro_vector[1],
-                    gyro_vector[2],
-                    mag_vector[0],
-                    mag_vector[1],
-                    mag_vector[2],
-                    printDouble(buffer3, pressure_value),
-                    printDouble(buffer1, temp_value),
-                    printDouble(buffer2, humid_value));
-            }
-
-            else
-            {
-                sprintf(sensor_text, "x:%d,y:%d,z:%d,p:%s,al:%s,t:%s,l:%s,c:%s",
-                    accel_data._x,
-                    accel_data._y,
-                    accel_data._z,
-                    lora_press_string,
-                    lora_alt_string,
-                    lora_temp_string,
-                    lora_light_string,
-                    lora_current_string);
-            }
-
-            if ((mdot_ret = sendString((const std::string)sensor_text)) != mDot::MDOT_OK) {
-                log_error(mdot_radio, "ERROR: Failed to Send Data", mdot_ret);
-            } else {
-                printf("Ok, Successfully Sent Data to Gateway...\r\n");
+                //---------------------------------------------------------------------------
+                // Byte Vector Format:  More Data Payload, Less Human Readible
+                //---------------------------------------------------------------------------
+    
+                if(!bHasLCD && bHasACC)
+                {
+    
+                    sprintf(sensor_text, "ax:%d,ay:%d,az:%d,gx:%d,gy:%d,gz:%d,mx:%d,my:%d,mz:%d,p:%s,t:%s,h:%s",
+                        accel_vector[0],
+                        accel_vector[1],
+                        accel_vector[2],
+                        gyro_vector[0],
+                        gyro_vector[1],
+                        gyro_vector[2],
+                        mag_vector[0],
+                        mag_vector[1],
+                        mag_vector[2],
+                        printDouble(buffer3, pressure_value),
+                        printDouble(buffer1, temp_value),
+                        printDouble(buffer2, humid_value));
+                }
+    
+                else
+                {
+                    sprintf(sensor_text, "x:%d,y:%d,z:%d,p:%s,al:%s,t:%s,l:%s,c:%s",
+                        accel_data._x,
+                        accel_data._y,
+                        accel_data._z,
+                        lora_press_string,
+                        lora_alt_string,
+                        lora_temp_string,
+                        lora_light_string,
+                        lora_current_string);
+                }
+    
+                if ((mdot_ret = sendString((const std::string)sensor_text)) != mDot::MDOT_OK) {
+                    log_error(mdot_radio, "ERROR: Failed to Send Data", mdot_ret);
+                } else {
+                    printf("Ok, Successfully Sent Data to Gateway...\r\n");
+                }
+    
+                /*
+                //---------------------------------------------------------------------------
+                // Binary Encoded Format:  Most Data Payload, Not Human Readible
+                //---------------------------------------------------------------------------
+                mdot_data.clear();
+                mdot_data.push_back(0x0E);              // key for Current Acceleration 3-Axis Value
+                converts.f_s = accel_data._x *4;        // shift data 2 bits while retaining sign
+                mdot_data.push_back(converts.t_u[1]);   // get 8 MSB of 14 bit value
+                converts.f_s = accel_data._y * 4;       // shift data 2 bits while retaining sign
+                mdot_data.push_back(converts.t_u[1]);   // get 8 MSB of 14 bit value
+                converts.f_s = accel_data._z * 4;       // shift data 2 bits while retaining sign
+                mdot_data.push_back(converts.t_u[1]);   // get 8 MSB of 14 bit value
+                mdot_data.push_back(0x08);              // key for Current Pressure Value
+                convertl.f_u = pressure;                // pressure data is 20 bits unsigned
+                mdot_data.push_back(convertl.t_u[2]);
+                mdot_data.push_back(convertl.t_u[1]);
+                mdot_data.push_back(convertl.t_u[0]);
+                mdot_data.push_back(0x05);              // key for Current Ambient Light Value
+                converts.f_u = lux_data;                // data is 16 bits unsigned
+                mdot_data.push_back(converts.t_u[1]);
+                mdot_data.push_back(converts.t_u[0]);
+                mdot_data.push_back(0x0B);              // key for Current Temperature Value
+                converts.f_s = baro_data._temp;         // temperature is signed 12 bit
+                mdot_data.push_back(converts.t_u[1]);
+                mdot_data.push_back(converts.t_u[0]);
+    
+                if ((mdot_ret = mdot_radio->send(mdot_data)) != mDot::MDOT_OK) {
+                    log_error(mdot_radio, "ERROR: Failed to Send Data", mdot_ret);
+                } else {
+                    printf("Ok, Successfully Sent Data to Gateway...\r\n");
+                }
+    
+                */
+    
+                osDelay(500);
+                sprintf(txtstr,"Scanning...     ");
+                if( bHasLCD ) evbLCD->writeText(0,7,font_6x8,txtstr,strlen(txtstr));
+                cycle_cnt = 0;
             }
-
-            /*
-            //---------------------------------------------------------------------------
-            // Binary Encoded Format:  Most Data Payload, Not Human Readible
-            //---------------------------------------------------------------------------
-            mdot_data.clear();
-            mdot_data.push_back(0x0E);              // key for Current Acceleration 3-Axis Value
-            converts.f_s = accel_data._x *4;        // shift data 2 bits while retaining sign
-            mdot_data.push_back(converts.t_u[1]);   // get 8 MSB of 14 bit value
-            converts.f_s = accel_data._y * 4;       // shift data 2 bits while retaining sign
-            mdot_data.push_back(converts.t_u[1]);   // get 8 MSB of 14 bit value
-            converts.f_s = accel_data._z * 4;       // shift data 2 bits while retaining sign
-            mdot_data.push_back(converts.t_u[1]);   // get 8 MSB of 14 bit value
-            mdot_data.push_back(0x08);              // key for Current Pressure Value
-            convertl.f_u = pressure;                // pressure data is 20 bits unsigned
-            mdot_data.push_back(convertl.t_u[2]);
-            mdot_data.push_back(convertl.t_u[1]);
-            mdot_data.push_back(convertl.t_u[0]);
-            mdot_data.push_back(0x05);              // key for Current Ambient Light Value
-            converts.f_u = lux_data;                // data is 16 bits unsigned
-            mdot_data.push_back(converts.t_u[1]);
-            mdot_data.push_back(converts.t_u[0]);
-            mdot_data.push_back(0x0B);              // key for Current Temperature Value
-            converts.f_s = baro_data._temp;         // temperature is signed 12 bit
-            mdot_data.push_back(converts.t_u[1]);
-            mdot_data.push_back(converts.t_u[0]);
-
-            if ((mdot_ret = mdot_radio->send(mdot_data)) != mDot::MDOT_OK) {
-                log_error(mdot_radio, "ERROR: Failed to Send Data", mdot_ret);
-            } else {
-                printf("Ok, Successfully Sent Data to Gateway...\r\n");
-            }
-
-            */
-
-            osDelay(500);
-            sprintf(txtstr,"Scanning...     ");
-            if( bHasLCD ) evbLCD->writeText(0,7,font_6x8,txtstr,strlen(txtstr));
-            cycle_cnt = 0;
         }
 
         osDelay(1000);