Qubit 2020 / presensfirmwareupdate

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
whiteheadrf
Date:
Thu Jun 23 19:33:33 2022 +0000
Parent:
1:eac9f7a0488f
Commit message:
version for xbee wifi, new presens boards with firmware update to include view0005 and 4 wire pumps

Changed in this revision

2021fork3/main.cpp Show annotated file Show diff for this revision Revisions of this file
2021fork3/presens.cpp Show annotated file Show diff for this revision Revisions of this file
2021fork3/pump.cpp Show annotated file Show diff for this revision Revisions of this file
2021fork3/wifi.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/2021fork3/main.cpp	Wed Mar 10 21:09:24 2021 +0000
+++ b/2021fork3/main.cpp	Thu Jun 23 19:33:33 2022 +0000
@@ -162,14 +162,14 @@
  //   L2=1;
  //   L3=1;
 
-    buzzerBeep(0.1);
-    wait(0.1);
-    buzzerBeep(0.1);
-    wait(0.1);
-    buzzerBeep(0.1);
-    wait(0.1);
-    buzzerBeep(0.1);
-    wait(0.1);
+    buzzerBeep(0.2);
+    wait(0.2);
+    buzzerBeep(0.2);
+    wait(0.2);
+    buzzerBeep(0.2);
+    wait(0.2);
+    buzzerBeep(0.2);
+    wait(0.2);
     
     INFO("Done startup. Enter event loop");
 
--- a/2021fork3/presens.cpp	Wed Mar 10 21:09:24 2021 +0000
+++ b/2021fork3/presens.cpp	Thu Jun 23 19:33:33 2022 +0000
@@ -76,6 +76,8 @@
     presenseComm.printf("tmpc2000\r");
     wait(PRESENS_CONFIG_DELAY);
 
+  //  presenseComm.printf("mode0000\r");
+  //  wait(PRESENS_CONFIG_DELAY);
 
 }
 
@@ -87,7 +89,7 @@
     int PRESENS_FLOAT_LENGTH = 7;
 
     presenseComm.printf("data\r");
-    wait(0.3);
+    wait(0.2);
     adcGetData();
     wait(0.1);
 
@@ -99,7 +101,7 @@
     }
 
 
-    L3=1;
+    L3 = 1;
 
     
     // read the each data packet
@@ -118,9 +120,13 @@
     presenseComm.getc();
     presenseComm.getc();
 
+    //this wait seems to cure the chart stutter that was happening with the new Presens board
+    wait(0.55);
 
     L4=1;
   
+//    wait(0.05);
+  
     PRESENS_FLOAT_LENGTH = 4;
 
     phase = presensReadFloat(PRESENS_FLOAT_LENGTH) / 100;
@@ -133,12 +139,12 @@
     while(presenseComm.readable()) {
         presenseComm.getc();
     }
-
+    wait(0.05);
 
     // end of the data extraction
 
 
-    L3=1;
+//    L3=1;
 
 
     DEBUG1("Amplitude=%5.0f Phase=%5.2f", amplitude, phase);
@@ -157,7 +163,7 @@
     DEBUG1("Result array:amplitude=%5.0f, phase=%2.2f, OxsenseData=%3.3f", amplitude, phase, result[2]);
 
 
-    L3=0;
+//    L3=0;
     L4=0;
 
 }
--- a/2021fork3/pump.cpp	Wed Mar 10 21:09:24 2021 +0000
+++ b/2021fork3/pump.cpp	Thu Jun 23 19:33:33 2022 +0000
@@ -9,7 +9,7 @@
 
 // Pulse width for DM212 pump can be 1-2 ms,
 // where 1 ms - pump is off, 2 ms  - pump is on with maximum speed. new pump driver parameters 4-2019
-#define PUMP_PULSE_WIDTH_MIN_US 1000
+#define PUMP_PULSE_WIDTH_MIN_US 950
 #define PUMP_PULSE_WIDTH_MAX_US 2000
 
 // Zero pulse width is used to disable pulse
--- a/2021fork3/wifi.cpp	Wed Mar 10 21:09:24 2021 +0000
+++ b/2021fork3/wifi.cpp	Thu Jun 23 19:33:33 2022 +0000
@@ -36,7 +36,7 @@
 #define WIFI_EXIT_CMD_MODE_RESPONCE         "OK"
 #define WIFI_NORMAL_CMD_RESPONSE             "OK"
 
-#define WIFI_MESSAGE_BUF_LENGTH 256
+#define WIFI_MESSAGE_BUF_LENGTH 1024
 
 #define OK      0
 #define NOK     1
@@ -160,6 +160,7 @@
     char* charIt;
     char* new_var1;
     char* new_var2;
+    char* rf_payload_bytes;
 
     /*
      * Two step of configuration needed, since some parameters
@@ -267,8 +268,8 @@
     new_var2 = (char*) malloc (strlen(message_temp)+1);
     memcpy ( new_var2, message_temp, strlen(message_temp)+1 );
     INFO("Wifi's module MAC address:{%s%s}", new_var1, new_var2);  
-     
-
+    
+ 
     //message_temp[charWriteIx] = 0; 
     //INFO("Wifi's module MAC address:{%s}", message_temp);
     
@@ -283,8 +284,15 @@
     // Set the ip addressing mode to DHCP
     //wifiSendString("ATMA 0\r");
     //wait(WIFI_CMD_DELAY);
-    //wifiCheckResponse(WIFI_NORMAL_CMD_RESPONSE);  
-
+    //wifiCheckResponse(WIFI_NORMAL_CMD_RESPONSE); 
+    
+    //get rf payload buffer size in hex
+    wifiSendString("ATNP\r");
+    wait(WIFI_CMD_DELAY);
+    rf_payload_bytes = wifiGetStringMessage();
+    INFO("Wifi's RF payload bytes:{%s}", rf_payload_bytes);
+     
+     
     wifiSendString("ATAC\r");
     wait(WIFI_CMD_DELAY);
     wifiCheckResponse(WIFI_NORMAL_CMD_RESPONSE);