example-ublox-cellular-psm

Dependencies:   ublox-cellular-base-SARA-R5 ublox-at-cellular-interface INA219

Files at this revision

API Documentation at this revision

Comitter:
mudassar0121
Date:
Tue Feb 04 17:26:04 2020 +0500
Parent:
11:3d81077eea43
Child:
13:eb3632730c09
Commit message:
upsv enabled

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Feb 04 16:44:00 2020 +0500
+++ b/main.cpp	Tue Feb 04 17:26:04 2020 +0500
@@ -219,6 +219,7 @@
     SocketAddress udpSenderAddress;
     char buf[1024];
     int x;
+    int upsv_status;
 #ifdef TARGET_UBLOX_C027
     // No user button on C027
     InterruptIn userButton(NC);
@@ -237,9 +238,24 @@
     }
     pulseEvent();
 
+
+
 #ifdef TARGET_UBLOX_C030_R412M
 
-    wait_ms(10000);
+    if (interface->get_idle_mode(&upsv_status)) {
+        printf("\n\nIdle mode is %s\n", upsv_status ? "Enabled" : "Disabled");
+    }
+
+    if (!upsv_status) {
+        printf("Enabling idle mode...\n");
+        if (interface->set_idle_mode(true) == false)
+        {
+            printf("Unable to set idle mode, is PSM enabled?\n");
+        }
+        if (interface->get_idle_mode(&upsv_status)) {
+            printf("Idle mode is %s\n", upsv_status ? "Enabled" : "Disabled");
+        }
+    }
 
     print_function("Enabling PSM...\n");
     if (interface->set_power_saving_mode(30, 30)) { //enable PSM