Sergei G / Mbed OS Borsch

Dependencies:   DataStore JobScheduler NetworkServices W5500Interface nanopb protocol

Revision:
20:5b52a42b9a5d
Parent:
18:133a51becbe1
Child:
28:7214f7806526
--- a/source/jobSchedulesUpload.cpp	Fri Aug 04 00:20:33 2017 +0000
+++ b/source/jobSchedulesUpload.cpp	Fri Aug 04 18:33:30 2017 +0000
@@ -56,10 +56,14 @@
     // the code terminates with error:
     //     CMSIS-RTOS error: Stack underflow (status: 0x1, task ID: 0x20002464, task name: )
     // shortly after quitting this function.
+    //
+    // Bob P recommendation: try static as a solution.
+    
+    protocol_JobList pbJobsPtr; /// = new protocol_JobList(); // protocol_JobList_init_zero;
     
     protocol_JobList* pbJobsPtr = new protocol_JobList(); // protocol_JobList_init_zero;
     protocol_JobList& pbJobs = *pbJobsPtr;
-    // tr_debug("pbJobs size: %d", sizeof(pbJobs));
+    //tr_debug("pbJobs size: %d", sizeof(pbJobs));
     
     strcpy(pbJobs.sn, this->_conf.SerialNumber());
     
@@ -83,11 +87,14 @@
             }
             //tr_debug("schedule data size: %d", pbJobs.items[idx].ScheduleData.size);
             // pbJobs.items[idx].Data = 
+            idx++;
             pbJobs.items_count = idx;
             
             apts.remove(1);
             aptn = apts.pop(1);
-            idx++;
+        }
+        if (idx == 0) {
+            tr_info("There are no jobs to send.");
         }
     }