LoadCell_STM32_SDRAM_v1

Dependencies:   BSP_DISCO_F746NG DISCO-F746NG_SDRAMBlockDevice LCD_DISCO_F746NG mbed

Fork of LoadCell_STM32 by Tapio Valli

Revision:
5:f8d3bcb187de
Parent:
4:5fe86291ba03
Child:
6:641b171407c9
--- a/main.cpp	Sat Feb 24 11:31:09 2018 +0000
+++ b/main.cpp	Sat Feb 24 16:18:46 2018 +0000
@@ -40,11 +40,18 @@
     Array Data;
     initArray(&Data,NoOfPoints);  // initially 19200 elements
     
+    InitScreen(LCD_COLOR_BLACK,LCD_COLOR_WHITE);
+    LCDWrite(5,"Ready.",CENTER_MODE);
+    
     while (!((strcmp(Cmd,"quit")==0)&&(n==1))) {
         
-        // Print Ready and current settings 
-        pc1.printf("Ready. Settings are Points = %u, Avg = %u, Period_us = %u, Count_ms = %u \r\n",
-                   NoOfPoints,AvgSize,Period_us,Count_ms);
+        // Print Ready and current settings
+        
+        pc1.printf(
+        "Ready. Settings are Points=%u, Avg=%u, Period_us=%u, "
+        "Count_ms=%u. Sampling will take apprx. %.3f secs\r\n",
+        NoOfPoints,AvgSize,Period_us,Count_ms,
+        (float)(NoOfPoints*Period_us/1000000.0));
                    
         mbed_stats_heap_get(&heap_stats);
         printf("Current heap: %lu\r\n", heap_stats.current_size);
@@ -88,11 +95,9 @@
         else if((strcmp(Cmd,"setpoints")==0)&&(n==2)) {
             // Allocate more or less data space
             NoOfPoints=(uint32_t) strtol(Arg,NULL,10);
-            pc1.printf("Old Data size is %u New NoOfPOints = %u \r\n",Data.size,NoOfPoints);
-            //freeArray(&Data);
-            //initArray(&Data,NoOfPoints);
-            insertArray2(&Data,NoOfPoints);
-            pc1.printf("New Array size is %u \r\n",Data.size);
+            //pc1.printf("Old Data size is %u New NoOfPOints = %u \r\n",Data.size,NoOfPoints);
+            insertArray(&Data,NoOfPoints);
+            //pc1.printf("New Array size is %u \r\n",Data.size);
         }
             
         // setavg: Adjust average amount in samples            
@@ -121,7 +126,11 @@
     
     // Free memory after quit
     freeArray(&Data);
-    pc1.printf("Exit. Data freed. \r\n");
+
+    // Print informative messages
+    InitScreen(LCD_COLOR_BLACK,LCD_COLOR_WHITE);
+    LCDWrite(5,"Stop.",CENTER_MODE);    
+    pc1.printf("Exit. Data freed. Stop. \r\n");
     
     // Infinite loop
     while(1)