Dependencies:   EthernetInterface FastPWM mbed-rtos mbed MODSERIAL

Files at this revision

API Documentation at this revision

Comitter:
darth_bachious
Date:
Mon Jul 02 08:52:05 2018 +0000
Parent:
14:e162b5fd0382
Commit message:
Very small bugfix, now contains a energy queue. Had no impact upon till this point, but should be included for later iterations

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e162b5fd0382 -r 15356e30738a main.cpp
--- a/main.cpp	Wed Jun 27 08:46:42 2018 +0000
+++ b/main.cpp	Mon Jul 02 08:52:05 2018 +0000
@@ -401,7 +401,9 @@
                     memcpy(&received_transparancy,&data[4],4);
                     memcpy(&received_passivity,&data[8],4);
                     memcpy(&input,&data[12],4);
-                    memcpy(&received_package,&data[16],4);
+                    float E_IN = 0.0;
+                    memcpy(&E_IN,&data[16],4);
+                    received_package += E_IN;                    
                     percentage_received = (float) counter_not_missed/100;
                     if(percentage_received<0.90) {
                         led3=1;
@@ -451,7 +453,7 @@
             float current_transparancy = update_delay(delayArrayMODE,received_transparancy);
             float current_passivity = update_delay(delayArrayPASS,received_passivity);
             float package_in = update_delay(delayArrayENERGY,received_package);
-            received_package = 0; //IMPORTANT, WILL EXPLODE OTHERWISE
+            received_package = 0.0; //IMPORTANT, WILL EXPLODE OTHERWISE
 
             if(identity==0) {
                 transparancy = current_transparancy;
@@ -513,7 +515,7 @@
             else
                 led2=1;
 
-            controller_check = 0;
+            controller_check = 0;   
             debug = 0;
         }
         osDelay(0.1); // This line is key, otherwise the MBED will not switch to the receive() thread.