Added unit tests and current gear display

--- tinkering/interface/lcdController/lcdController.ino
+++ tinkering/interface/lcdController/lcdController.ino
@@ -9,6 +9,7 @@
 dev board and the screen, and a 330 ohm resistor between the backlight pin(P1_2), and the screen.
 Note that the pin labled SCL* on the dev board is used instead of SCLK for the screen SCLK input.

+Run tests by uncommenting the define TEST and calling the runTests() function
 Ryan Becwar
 */

@@ -27,9 +28,14 @@
 #define LCD_X     84
 #define LCD_Y     48

+//Uncomment if you want to run in test mode
+#define TEST
+
+
 //Cadence will never go above 200, so 8 bit ints work well
 uint8_t targetCadence = 0;
 uint8_t currentCadence = 0;
+uint8_t gearPos = 0;

 volatile int flag = HIGH;

@@ -222,8 +228,16 @@
   LcdString("            ");
   LcdString(curBuf);
   LcdString("            ");
-  LcdString("            ");
-
+  LcdString("Gear:      5");
+
+  #ifdef TEST
+    Serial.println(tarBuf);
+    Serial.println("____________");
+    Serial.println("            ");
+    Serial.println(curBuf);
+    Serial.println("            ");
+    Serial.println("Gear:      5");
+   #endif
 }

 /*Functions to handle buttons to increase or decrease target cadence.*/
@@ -239,9 +253,101 @@
   targetCadence--;
 }

+uint8_t setCurrent(uint8_t cadence){
+  currentCadence = cadence;
+  return currentCadence;
+}
+
+uint8_t setGear(uint8_t gear){
+  if(gear < 1)
+    gear = 0;
+  if(gear > 8)
+    gear = 8;
+   gearPos = gear;
+}
+
+//Writes output to Serial, always returns true
+int testWrite(void){
+  writeCadence();
+  return 0;
+}
+
+//Tests the setCurrent function
+int testCurrentAdjust(){
+  setCurrent(124);
+  if(currentCadence == 124)
+    return 0;
+  else
+    return 1;
+}
+
+int testSetGear(){
+  setGear(5);
+  if(gearPos == 5)
+    return 0;
+  else
+    return 1;
+}
+
+int testSetGearTooHigh(){
+  setGear(200);
+  if(gearPos == 8)
+    return 0;
+  else
+    return 1;
+}
+
+//Tests return 0 if pass, 1 if fail
+//This should definitley be restructured to use function pointers and iteration, but is used now in interest of time.
+void runTests(void){
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println("TEST: testWrite");
+  Serial.println("OUTPUT:");
+  if(!testWrite()){
+    Serial.println("PASSED");
+  } else {
+    Serial.println("FAILED");
+  }
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println();
+
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println("TEST: testCurrentAdjust");
+  Serial.println("OUTPUT:");
+  if(!testCurrentAdjust()){
+    Serial.println("PASSED");
+  } else {
+    Serial.println("FAILED");
+  }
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println();
+
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println("TEST: testSetGear");
+  Serial.println("OUTPUT:");
+  if(!testSetGear()){
+    Serial.println("PASSED");
+  } else {
+    Serial.println("FAILED");
+  }
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println();
+
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println("TEST: testSetGearTooHigh");
+  Serial.println("OUTPUT:");
+  if(!testSetGearTooHigh()){
+    Serial.println("PASSED");
+  } else {
+    Serial.println("FAILED");
+  }
+  Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+  Serial.println();
+}

 void setup(void)
 {
+  Serial.begin(9600);
   //Setup Buttons
   //Enable internal pullup.
   //These will be changed to the button pins when connected to the board, curretnly represents redboard buttons
@@ -256,6 +362,8 @@
   targetCadence = 73;
   currentCadence = 25;
   writeCadence();
+
+  runTests();
 }

 void loop(void)


started PROGMEM

started PROGMEM

--- code/bite_alarm/bite_alarm.ino
+++ code/bite_alarm/bite_alarm.ino
@@ -1,3 +1,5 @@
+#include <avr/pgmspace.h>
+
 #define MAX_VOLUME 0
 #define MIN_VOLUME 0
 #define MAX_SENSITIVITY 0


add handlebutton event

add handlebutton event

--- scripts-arduino/bp_led_lp.ino
+++ scripts-arduino/bp_led_lp.ino
@@ -31,8 +31,23 @@

 // ############## LOOP ############################
 void loop(){
-  // read the state of the pushbutton value:
-  buttonState = digitalRead(buttonPin);
+  boolean eventResult = eventButton();
+
+  switch(eventResult){
+    case EV_NONE:
+      //TODO
+      break;
+    case EV_SHORTPRESS:
+      //TODO
+      break;
+    case EV_LONGPRESS:
+      //TODO
+      break;
+  }
+}
+
+void loop(){
+  buttonState = digitalRead(buttonPin);     // read the state of the pushbutton value:
   ledState = digitalRead(ledPin);

   // Wait until the button be pushed


Minor fixes

Minor fixes

* Added a message print
* Replaced pass with password

--- IDCF_MQTT_Subscriber/IDCF_MQTT_Subscriber.ino
+++ IDCF_MQTT_Subscriber/IDCF_MQTT_Subscriber.ino
@@ -44,10 +44,11 @@
     Serial.print("Connecting to ");
     Serial.print(ssid);
     Serial.println("...");
-    WiFi.begin(ssid, pass);
+    WiFi.begin(ssid, password);

     if (WiFi.waitForConnectResult() != WL_CONNECTED) {
       // Wi-Fiアクスポイントへの接続に失敗したら5秒間待ってリトライ
+      Serial.println("Failed to connect");
       delay(5000);
       return;
     } else {


No changes-- Official code.

No changes-- Official code.

--- Robot_Lights_Display/Robot_Lights_Display.ino
+++ Robot_Lights_Display/Robot_Lights_Display.ino
@@ -11,6 +11,7 @@

 #define YELLOW CRGB(255, 90, 0)
 #define BLUE CRGB(0, 50, 170)
+

 #define COG_SIZE 5


Added command to alert controller of collision avoidance alert.

--- src/piCar2.0.ino
+++ src/piCar2.0.ino
@@ -359,3 +359,14 @@
 int readUltra(){
   return 0;
 }
+void guides(){
+  if (frontUltra<10){
+    Serial1.println("c,"+String(frontUltra)+",");
+  }
+}
+void avoid(){
+  if (frontUltra<7){
+    motorGo(0, 0, 0);
+    motorGo(1, 0, 0);
+  }
+}


Fix LED Num for non analogue output (#1139)

--- assets/firmware/arduino/adalight/adalight.ino
+++ assets/firmware/arduino/adalight/adalight.ino
@@ -139,7 +139,7 @@
   }

   int ledCount = MAX_LEDS;
-  if (ANALOG_MODE == ANALOG_MODE_LAST_LED) {
+  if (ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_LAST_LED) {
     ledCount--;
   }

@@ -170,7 +170,7 @@
   showColor(CRGB(0, 0, 0));

   Serial.print("Ada\n"); // Send "Magic Word" string to host
-
+  Serial.println("Ada: LED num: " +  String(FastLED.size())); //Return number of LEDs configured

   boolean transmissionSuccess;
   unsigned long sum_r, sum_g, sum_b;
@@ -254,4 +254,3 @@
 void loop() {
   // Not used. See note in setup() function.
 }
-


added button and reed switch debouncing

added button and reed switch debouncing

--- zamek.ino
+++ zamek.ino
@@ -55,6 +55,8 @@
 const int toneDuration = 100;  //microseconds

 const int lockTransitionTime = 2000; // in microseconds
+
+const int debounceDelay = 50; // miliseconds

 bool isDoorLocked = true; //assumed state of door lock on uC power on

@@ -89,16 +91,33 @@
 const bool pressed = false;
 const bool released = true;

+int buttonEvent = 0;
+int doorEvent = 0;
+
+inline bool isStable(const int lastEvent){
+	return (millis() - lastEvent) > debounceDelay;
+}
+
 void loop() {
-		bool	button	= digitalRead(pinButtonSwitch);
-		bool	door	= digitalRead(pinReedSwitch);
-
-		if(previousButtonState == pressed and button == released and isDoorLocked)
-			unlockDoor();
+		bool button = digitalRead(pinButtonSwitch);
+		if(button != previousButtonState){
+			buttonEvent = millis();
+		}
+		if(isStable(buttonEvent) and button == pressed){
+			if(isDoorLocked){
+				unlockDoor();
+			}
+		}
 		previousButtonState=button;

-        if(previousDoorState == open and door == close)
-			lockDoor();
+		bool door = digitalRead(pinReedSwitch);
+		if(door != previousDoorState){
+			doorEvent = millis();
+		}
+		if(isStable(doorEvent) and door == close){
+			if(!isDoorLocked)
+				lockDoor();
+		}
 		previousDoorState=door;

 }


Dwell G4 Support

Dwell G4 Support

--- src/miscr.ino
+++ src/miscr.ino
@@ -76,6 +76,20 @@
 // Constructor for the updateLCD() function
 int updateLCD();

+class TimeControl {
+ public:
+  bool pause; // Whether the machine is paused or not
+  unsigned long pausetime; // Stamp for when the machine has been paused
+  unsigned int increment; // How long it should wait for
+  TimeControl() {
+    pause = false;
+    pausetime = -1;
+    increment = 0;
+  }
+};
+
+TimeControl time;
+
 /*
  * Feedrate class, stores information about the current delay the motors should
  * run at and the default value on startup.
@@ -494,6 +508,20 @@
     }

     return true;
+  } else if(gindex == 4) {
+    in = trim(in);
+
+    float pindex = getIndex('P', in);
+
+    if(pindex == INT_MIN) {
+      out.msg(1, "Parameter P Missing");
+      return false;
+    }
+
+    time.pause = true;
+    time.increment = pindex;
+
+    return true;
   }

   int mindex = getIndex('M', in);
@@ -704,9 +732,18 @@
 }

 void loop() {
-  getSerialInput();
-  sX.updateLoop();
-  sY.updateLoop();
-  fanOn(temperature.operation);
-  updatePos();
-}
+  if(!time.pause) {
+    getSerialInput();
+    sX.updateLoop();
+    sY.updateLoop();
+    fanOn(temperature.operation);
+    updatePos();
+  } else {
+    if(time.pausetime == 0)
+      time.pausetime = millis();
+    if(millis() > time.pausetime + time.increment) {
+      time.pausetime = 0;
+      time.pause = false; // Return to regular operation
+    }
+  }
+}


Added M114 support and better error handling

--- src/miscr.ino
+++ src/miscr.ino
@@ -37,6 +37,10 @@

 #define PS_ON_PIN          12
 #define KILL_PIN           -1
+#define INT_MIN            -10000 // Unfortunately needed for error-checking
+                                  // Not technically the lowest value for int
+                                  // however, got overflow errors when I did
+                                  // enter the lowest value

 byte downline[8] = {
   B10000,
@@ -235,12 +239,16 @@
   int spaceIndex = in.indexOf(" ");
   bool toEnd = false;

+  if(in.length() < 2) {
+    return INT_MIN;
+  }
+
   if(spaceIndex == -1) {
     toEnd = true;
   }

   if(codeIndex == -1) {
-    return -1;
+    return INT_MIN;
   }

   if(!toEnd) {
@@ -250,15 +258,14 @@
     String toconvert = in.substring(codeIndex + 1);
     return toconvert.toInt();
   }
-  return -2;
+
+  return INT_MIN;
 }

 String trim(String in) {
   int spaceIndex = in.indexOf(" ");
   return in.substring(spaceIndex + 1, in.length());
 }
-
-int strtoint(String in) {return in.toInt();}

 /*
  * This function does not yet have any GCode parsing functionality,
@@ -281,15 +288,22 @@
     if(xindex > -1) sX.testSpin(xindex * 80);
     if(yindex > -1) sY.testSpin(yindex * 80);

-    if(xindex < 0 && yindex < 0) {
-      out.msg(1, "No parameters for G0/G1");
+    if(xindex == INT_MIN && yindex == INT_MIN) {
+      out.msg(1, "No parameters/Invalid values for G0/G1");
       return false;
     }

     return true;
   }

-  out.msg(1, "Incorrect G-Code entered");
+  int mindex = getIndex('M', in);
+
+  if(mindex == 114) {
+    out.pos(0);
+    return false;
+  }
+
+  out.msg(1, "Incorrect/Unsupported G-Code entered");
   return false;
 }

@@ -386,7 +400,7 @@
   globalPos.x = sX.pos;
   globalPos.y = sY.pos;

-  updateLCD();
+  //updateLCD();
 }

 void setup() {
@@ -408,5 +422,5 @@
   getSerialInput();
   sX.updateLoop();
   sY.updateLoop();
-  //updatePos();
-}
+  updatePos();
+}


fixed leaky button

fixed leaky button

--- display/display.ino
+++ display/display.ino
@@ -337,9 +337,10 @@
 }

 TS_Point getFixedCoordinates(void){
+   if (ts.bufferEmpty()) { return TS_Point(tft.height(), tft.width(), 0); }
    TS_Point p = ts.getPoint();
    while(!ts.bufferEmpty()){
-       volatile TS_Point q = ts.getPoint();
+       p = ts.getPoint();
    }
    // Scale from 0-4000 to tft.width() using calibration numbers
    p.x = tft.height() - map(p.x, TS_MINX, TS_MAXX, 0, tft.height());


Fixing merge

Fixing merge

--- SensorShirt/PositionFunctions.ino
+++ SensorShirt/PositionFunctions.ino
@@ -1,17 +1,10 @@
 /*
-<<<<<<< HEAD
-  Position Functions
-  Kylie Dale and Michael Guida
-*/
-/*
-=======
  * Position Functions
  * Kylie Dale and Michael Guida
  */
-
+/*
 // ------------------------ Right ------------------------

->>>>>>> origin/master
 boolean armAtSideRight() {
   if(backValue > (armSRBackVal - armSRBackTol) && backValue < (armSRBackVal + armSRBackTol)) {
     if(rShoulderValue > (armSRShoulderVal - armSRShoulderTol) && rShoulderValue < (armSRShoulderVal + armSRShoulderTol)) {
@@ -189,9 +182,6 @@
   }
   return false;
 }
-<<<<<<< HEAD
-*/
-=======

 boolean armFwdLeft135() {
   if(backValue > (armFL135BackVal - armFL135BackTol) && backValue < (armFL135BackVal + armFL135BackTol)) {
@@ -249,4 +239,4 @@
   }
   return false;
 }
->>>>>>> origin/master
+*/


Fix #207

Fix #207

--- examples/Export_Demo/myPlant_ESP8266/myPlant_ESP8266.ino
+++ examples/Export_Demo/myPlant_ESP8266/myPlant_ESP8266.ino
@@ -148,7 +148,6 @@
     if (sensorSoilMoisture < 20) {
       if (isNotificationSent == false) {
         Blynk.email("myPlant notification", "Your plant is thirsty!");
-        Blynk.notify("Your plant is thirsty!");
         isNotificationSent = true;
       }
     }
@@ -162,6 +161,12 @@
     if (sensorSoilMoisture > 30) {
       isNotificationSent = false;
     }
+    if (sensorSoilMoisture >= 85) {
+      // Stop watering
+      timer.disable(wateringTimer);
+      // Update "Start Watering" button widget state
+      Blynk.virtualWrite(V6, 0);
+    }
   });
   timer.disable(wateringTimer);


Increased release string length to 10.

Increased release string length to 10.

--- versioncheck.ino
+++ versioncheck.ino
@@ -1,6 +1,7 @@
 /* https://github.com/espressif/arduino-esp32/issues/846 */
+const uint8_t releaseLength = 10;

-char newRelease[8];
+char newRelease[releaseLength];
 bool newReleaseFound = false;

 void versionCheck ( void * pvParameters )
@@ -40,8 +41,6 @@
     http.begin( latestReleaseAPI, github_root_ca );
     uint8_t httpCode = http.GET();

-    ESP_LOGI( TAG, "GitHub https request result: %i", httpCode );
-
     if ( httpCode == 200 )
     {
       const size_t capacity = 2200;
@@ -54,25 +53,22 @@
       }
       else
       {
-        char installedRelease[8];
+        char installedRelease[releaseLength];
+
         uint8_t i = 0;
         while ( ( sketchVersion[i] != '-' ) && ( i < sizeof( installedRelease ) ) )
         {
           installedRelease[i] = sketchVersion[i];
           i++;
         }
+
+        ESP_LOGI( TAG, "Local release: '%s'", installedRelease );
         strncpy( newRelease, root["tag_name"], sizeof( newRelease ) );
-        ESP_LOGI( TAG, "Local Version: '%s'", installedRelease );
-
-        if ( strcmp ( installedRelease, newRelease) < 0 )
+        if ( strcmp ( installedRelease, newRelease) != 0 )
         {
           newReleaseFound = true;
-          ESP_LOGI( TAG, "Found new version: '%s'", newRelease );
         }
-        else
-        {
-          ESP_LOGI( TAG, "No new version found.");
-        }
+        ESP_LOGI( TAG, "%s new release was found: '%s'", ( newReleaseFound == true ) ? "A" : "No", newRelease );
       }
     }
     else


Added suport for Firmata4j java library

Added suport for Firmata4j java library

--- examples/BluefruitLE_nrf51822/BluefruitLE_nrf51822.ino
+++ examples/BluefruitLE_nrf51822/BluefruitLE_nrf51822.ino
@@ -739,7 +739,7 @@

 void firmataInit() {
   FIRMATADEBUG.println(F("Init firmata"));
-  //BLE_Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
+  BLE_Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
   //FIRMATADEBUG.println(F("firmata analog"));
   BLE_Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
   //FIRMATADEBUG.println(F("firmata digital"));


Fix comment

Fix comment

--- examples/Boards_WiFi/ESP8266_Shield/ESP8266_Shield.ino
+++ examples/Boards_WiFi/ESP8266_Shield/ESP8266_Shield.ino
@@ -14,7 +14,8 @@
  *
  **************************************************************
  *
- * This example shows how to use ESP8266 Shield via  to connect your project to Blynk.
+ * This example shows how to use ESP8266 Shield (with AT commands)
+ * to connect your project to Blynk.
  *
  * Note: Ensure a stable serial connection to ESP8266!
  *       Firmware version 1.0.0 (AT v0.22) is needed.


Fix of delay in response on button click

--- Prototype-UR2/InternetButton/buzzy-pixel/buzzy-pixel.ino
+++ Prototype-UR2/InternetButton/buzzy-pixel/buzzy-pixel.ino
@@ -31,7 +31,7 @@
     // Publish the event PUBLISH_EVENT_NAME for paired device to use
     // with data stored in buffer array
     char buffer[60] = "click";
-    Particle.publish(PUBLISH_EVENT_NAME,String(buffer), 100, PRIVATE);
+    Particle.publish(PUBLISH_EVENT_NAME,String(buffer), 60, PRIVATE);
     delay(500);
   }
   else {
@@ -55,6 +55,6 @@
     delay(2000);
     // Turn off all LEDs
     b.allLedsOff();
-    delay(1000);
+    delay(100);
   }
 }


put in mqtt

put in mqtt

--- ardesp/waterelf_winter_garden/waterelf_winter_garden.ino
+++ ardesp/waterelf_winter_garden/waterelf_winter_garden.ino
@@ -3,6 +3,7 @@
 #include <ESP8266WiFi.h>
 #include <WiFiClient.h>
 #include <ESP8266WebServer.h>
+#include <PubSubClient.h>
 #include "./DNSServer.h"      // patched lib
 #include <FS.h>
 #include <OneWire.h>
@@ -33,6 +34,13 @@
 String apSSIDStr = "WaterElf-" + String(ESP.getChipId());
 const char* apSSID = apSSIDStr.c_str();
 String svrAddr = ""; // address of a local server
+
+/////////////////////////////////////////////////////////////////////////////
+// MQTT stuff ///////////////////////////////////////////////////////////////
+const boolean SEND_MQTT = true;  // turn on/off posting of data to MQTT
+void callback(const MQTT::Publish& pub) {
+  // handle message arrived
+}

 /////////////////////////////////////////////////////////////////////////////
 // page generation stuff ////////////////////////////////////////////////////
@@ -91,7 +99,7 @@

 /////////////////////////////////////////////////////////////////////////////
 // data monitoring stuff ////////////////////////////////////////////////////
-const boolean SEND_DATA = true;  // turn off posting of data if required here
+const boolean SEND_DATA = false;  // turn off posting of data if required here
 const int MONITOR_POINTS = 60; // number of data points to store
 typedef struct {
   unsigned long timestamp;
@@ -112,6 +120,7 @@
 const int DATA_ENTRIES = 4; // size of /data rpt; must be <= MONITOR_POINTS
 void updateSensorData(monitor_t *monitorData);
 void postSensorData(monitor_t *monitorData);
+void sendSensorData(monitor_t *monitorData);
 void printMonitorEntry(monitor_t m, String* buf);
 void formatMonitorEntry(monitor_t *m, String* buf, bool JSON);

@@ -339,7 +348,7 @@
     if(SEND_DATA) {                     // push data to the cloud
       postSensorData(&monitorData[monitorCursor]); yield();
     }
-
+    if(SEND_MQTT) sendSensorData(&monitorData[monitorCursor]); yield();
     if(++monitorCursor == MONITOR_POINTS)
       monitorCursor = 0;
   }
@@ -764,6 +773,47 @@
   Serial.println("");
   return;
 }
+void sendSensorData(monitor_t *monitorData) {
+  Serial.println("\nsendSensorData");
+  WiFiClient wclient;
+  PubSubClient client(wclient, svrAddr);
+  client.set_callback(callback); // Register MQTT callback
+  if (client.connect("arduinoClient")) {
+    if(GOT_TEMP_SENSOR){
+      String wc;
+      wc.concat(monitorData->waterCelsius);
+      client.publish("WaterTemp",wc);
+    }
+    if(GOT_HUMID_SENSOR){
+      String ac,hm;
+      ac.concat(monitorData->airCelsius);
+      hm.concat(monitorData->airHumid);
+      client.publish("AirTemp",ac);
+      client.publish("Humidity",hm);
+    }
+    if(GOT_LIGHT_SENSOR){
+      String lx;
+      lx.concat(monitorData->lux);
+      client.publish("Light",lx);
+    }
+    if(GOT_PH_SENSOR){
+      String ph;
+      ph.concat(monitorData->pH);
+      client.publish("pH",ph);
+    }
+    if(GOT_LEVEL_SENSOR){
+      String wl1, wl2, wl3;
+      wl1.concat(monitorData->waterLevel1);
+      wl2.concat(monitorData->waterLevel2);
+      wl3.concat(monitorData->waterLevel3);
+      client.publish("WaterLevel1",wl1);
+      client.publish("WaterLevel2",wl2);
+      client.publish("WaterLevel3",wl3);
+    }
+  }
+  return;
+}
+
 void formatMonitorEntry(monitor_t *m, String* buf, bool JSON) {
   if(JSON) buf->concat("{ ");
   buf->concat("~timestamp~+ ");


Fixed display bug

Fixed display bug

--- BlinkenScreen.ino
+++ BlinkenScreen.ino
@@ -74,7 +74,7 @@
     scratch >>= 24;

     // Loop over the half display
-    for (char i = 0; i <= 24; i++) {
+    for (char i = 0; i < 24; i++) {
       if (data & 1) {
         scratch |= conversion_table[i];
       }


turn off display backlight after 10 secs of innactivity

--- arduino_client/arduino_client.ino
+++ arduino_client/arduino_client.ino
@@ -1,5 +1,5 @@
 /*
- Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
+   Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
  library works with all LCD displays that are compatible with the
  Hitachi HD44780 driver. There are many of them out there, and you
  can usually tell them by the 16-pin interface.
@@ -40,6 +40,12 @@
 // initialize the library with the numbers of the interface pins
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

+int lcdPin = 10;
+int millisToTurnOff = 10000;
+
+unsigned long lastSavedTime;
+boolean turnedOff = false;
+
 byte celsius[8] = {
   B11110,
   B10010,
@@ -51,8 +57,13 @@
 };

 void setup() {
+
+  pinMode(lcdPin, OUTPUT);      // sets the digital pin as output
+  turnBacklightOn();
+
+  lastSavedTime = millis();
+
   Serial.begin(4800);
-
   Serial.println("Hi, I am alive!");

   // set up the LCD's number of columns and rows:
@@ -64,14 +75,25 @@
 int i = 0;
 void loop() {

-  if (Serial.available() >= 2){
+  int delta = millis() - lastSavedTime;
+
+  if(delta<0){
+    //overflow of millis();
+    lastSavedTime = millis();
+  }
+
+  if(!turnedOff&&delta>millisToTurnOff){
+    turnBacklightOff();
+  }
+
+  if (Serial.available() >= 2){
+
+    lastSavedTime = millis();

-    /*lcd.setCursor(0,0); //FOR TESTING
-     while(Serial.available()){
-     lcd.print(Serial.read());
-     lcd.print(" ");
-     }*/
-
+    if(turnedOff){
+      turnBacklightOn();
+    }
+
     // read the incoming byte:
     char input = char(Serial.read());

@@ -128,6 +150,15 @@
   lcd.print("RAM USAGE");
 }

+void turnBacklightOn(){
+  digitalWrite(lcdPin, HIGH);
+  turnedOff = false;
+}
+
+void turnBacklightOff(){
+  digitalWrite(lcdPin, LOW);
+  turnedOff = true;
+}

@@ -160,3 +191,8 @@

+
+
+
+
+


scanlines stored data got reset

scanlines stored data got reset

--- FirmwareManager/src/FirmwareManager.ino
+++ FirmwareManager/src/FirmwareManager.ino
@@ -1927,6 +1927,7 @@
     _readFile("/etc/scanlines/active", buffer, 32, DEFAULT_SCANLINES_ACTIVE);
     if (strcmp(buffer, SCANLINES_ENABLED) == 0) {
         scanlinesActive = true;
+        return;
     }
     scanlinesActive = false;
 }
@@ -1961,6 +1962,7 @@
     _readFile("/etc/scanlines/oddeven", buffer, 32, DEFAULT_SCANLINES_ODDEVEN);
     if (strcmp(buffer, SCANLINES_ODD) == 0) {
         scanlinesOddeven = true;
+        return;
     }
     scanlinesOddeven = false;
 }
@@ -1976,6 +1978,7 @@
     _readFile("/etc/scanlines/thickness", buffer, 32, DEFAULT_SCANLINES_THICKNESS);
     if (strcmp(buffer, SCANLINES_THICK) == 0) {
         scanlinesThickness = true;
+        return;
     }
     scanlinesThickness = false;
 }


Use millis for delay time

Use millis for delay time

--- MiniSumoStraitght/MiniSumoStraitght.ino
+++ MiniSumoStraitght/MiniSumoStraitght.ino
@@ -3,18 +3,10 @@
 MiniRobot robot;

 byte status;
-/*
-0 - don't need changes;
-1 - counter only
-2 - drive straight back;
-3 - drive straight forward;
-4 - spin around
- - enemy forward;
-*/
-
 unsigned long start_millis;
-long delay_millis;
-long dist;
+long delay_millis, enemy_millis = 5;
+long dist, dist_before, dist_good = 0;
+int good_count = 3;

 void setup() {
   pinMode(A0,INPUT);   // set Pin as Input (default)
@@ -23,8 +15,10 @@
   PCIFR  |= bit(1);
   PCICR  |= bit(1);
   status = 2;
+  start_millis = millis();
 }

+//interupt for IR sensor changes
 ISR (PCINT1_vect)
 {
   if (robot.leftEdge() || robot.rightEdge()) {
@@ -33,9 +27,8 @@
 }

 void loop() {
-  Serial.println(status);
   switch (status) {
-    case 1:
+    case 1:
       if ((millis() - start_millis) >= delay_millis) {
         status = 3;
       }
@@ -52,15 +45,28 @@
       break;
     case 4:
       robot.rightBack();
-      robot.leftForward();
-      delay_millis = 400;
+      robot.leftStop();
+      delay_millis = 80;
       start_millis = millis();
       status = 5;
       break;
     case 5:
-      dist = robot.distanceToEnemy();
-      if (((millis() - start_millis) >= delay_millis) || (dist > 5)) {
+      if (start_millis + enemy_millis <= millis()){
+        dist = robot.distanceToEnemy();
+        start_millis = millis();
+        if(dist + 2 >= dist_good && dist - 2 <= dist_good){
+          good_count--;
+        } else {
+          good_count = 3;
+          dist_good = dist;
+        }
+        if(dist != 0 && dist_good == 0){
+          dist_good = dist;
+        }
+      }
+      if (((millis() - start_millis) >= delay_millis) || (good_count <= 0 && dist_good > 0 && dist_good < 40)) {
         status = 3;
+        good_count = 3;
       }
       break;
   }


Arduino code cleanup.

Arduino code cleanup.

--- tomatino_Arduino/tomatino_Arduino.ino
+++ tomatino_Arduino/tomatino_Arduino.ino
@@ -1,8 +1,10 @@
 /**************************************************************************/
 /*!
-    @file     readMifare.pde
-    @author   Adafruit Industries
-    @license  BSD (see license.txt)
+    @file     tomatino_Arduino
+    @author   Encore Lab
+    Dependencies: Adafruit Adafruit_NFCShield_I2C Library at: https://github.com/adafruit/Adafruit_NFCShield_I2C
+    Adapted from example code at https://github.com/adafruit/Adafruit_NFCShield_I2C/tree/master/examples/readMifare
+    For use with the adafruit NFC/RFID Controller Shield for Arduino: https://www.adafruit.com/products/789

     This example will wait for any ISO14443A card or tag, and
     depending on the size of the UID will attempt to read from it.
@@ -19,20 +21,9 @@
     Ultralight card, and the 4 byte pages can be read directly.
     Page 4 is read by default since this is the first 'general-
     purpose' page on the tags.
-
-
-    This is an example sketch for the Adafruit PN532 NFC/RFID breakout boards
-    This library works with the Adafruit NFC breakout
-      ----> https://www.adafruit.com/products/364
-
-    Check out the links above for our tutorials and wiring diagrams
-    These chips use I2C to communicate
-
-    Adafruit invests time and resources providing this open source code,
-    please support Adafruit and open-source hardware by purchasing
-    products from Adafruit!
 */
 /**************************************************************************/
+
 #include <Wire.h>
 #include <Adafruit_NFCShield_I2C.h>

@@ -42,20 +33,15 @@
 Adafruit_NFCShield_I2C nfc(IRQ, RESET);

 void setup(void) {
-  Serial.begin(9600);
-  Serial.println("Hello!");
+  Serial.begin(9600); //Can change baud rate if neccessary, but 9600 is an easy standard.

   nfc.begin();

   uint32_t versiondata = nfc.getFirmwareVersion();
   if (! versiondata) {
-    Serial.print("Didn't find PN53x board");
+    Serial.print("Didn't find PN53x board, please try again.");
     while (1); // halt
   }
-  // Got ok data, print it out!
-  Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
-  Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
-  Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);

   // configure board to read RFID tags
   nfc.SAMConfig();
@@ -76,84 +62,10 @@

   if (success) {
     // Display some basic information about the card
-    Serial.println("Found an ISO14443A card");
-    Serial.print("  UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
-    Serial.print("  UID Value: ");
+    Serial.print("Found an ISO14443A card, ID is: ");
     nfc.PrintHex(uid, uidLength);
     Serial.println("");
-
-    if (uidLength == 4)
-    {
-      // We probably have a Mifare Classic card ...
-      Serial.println("Seems to be a Mifare Classic card (4 byte UID)");
-
-      // Now we need to try to authenticate it for read/write access
-      // Try with the factory default KeyA: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
-      Serial.println("Trying to authenticate block 4 with default KEYA value");
-      uint8_t keya[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
-
-      // Start with block 4 (the first block of sector 1) since sector 0
-      // contains the manufacturer data and it's probably better just
-      // to leave it alone unless you know what you're doing
-      success = nfc.mifareclassic_AuthenticateBlock(uid, uidLength, 4, 0, keya);
-
-      if (success)
-      {
-        Serial.println("Sector 1 (Blocks 4..7) has been authenticated");
-        uint8_t data[16];
-
-        // If you want to write something to block 4 to test with, uncomment
-        // the following line and this text should be read back in a minute
-        //memcpy(data, (const uint8_t[]){ 'a', 'd', 'a', 'f', 'r', 'u', 'i', 't', '.', 'c', 'o', 'm', 0, 0, 0, 0 }, sizeof data);
-        //success = nfc.mifareclassic_WriteDataBlock (4, data);
-
-        // Try to read the contents of block 4
-        success = nfc.mifareclassic_ReadDataBlock(4, data);
-
-        if (success)
-        {
-          // Data seems to have been read ... spit it out
-          Serial.println("Reading Block 4:");
-          nfc.PrintHexChar(data, 16);
-          Serial.println("");
-
-          // Wait a bit before reading the card again
-          delay(1000);
-        }
-        else
-        {
-          Serial.println("Ooops ... unable to read the requested block.  Try another key?");
-        }
-      }
-      else
-      {
-        Serial.println("Ooops ... authentication failed: Try another key?");
-      }
-    }
-
-    if (uidLength == 7)
-    {
-      // We probably have a Mifare Ultralight card ...
-      Serial.println("Seems to be a Mifare Ultralight tag (7 byte UID)");
-
-      // Try to read the first general-purpose user page (#4)
-      Serial.println("Reading page 4");
-      uint8_t data[32];
-      success = nfc.mifareultralight_ReadPage (4, data);
-      if (success)
-      {
-        // Data seems to have been read ... spit it out
-        nfc.PrintHexChar(data, 4);
-        Serial.println("");
-
-        // Wait a bit before reading the card again
-        delay(1000);
-      }
-      else
-      {
-        Serial.println("Ooops ... unable to read the requested page!?");
-      }
-    }
+    delay(1000); //wait a bit before trying to read again.
   }
 }


Add correct reading of roll, and increase data rate to 142 Hz

--- Calibration/liveCode/overclockAccel/overclockAccel.ino
+++ Calibration/liveCode/overclockAccel/overclockAccel.ino
@@ -10,6 +10,7 @@
 #include <String.h>
 #include <Adafruit_Sensor.h>
 #include <Adafruit_10DOF.h>
+#include <Adafruit_Simple_AHRS.h>

 /* Assign a unique ID to the sensors */
 Adafruit_10DOF   dof();
@@ -59,7 +60,7 @@
   dataFile = SD.open(FILENAME, FILE_WRITE);

   // If the file is available, write to it:
-  dataFile.println("Accel X, Accel Y, Accel Z, Yaw, Timestamp");
+  dataFile.println("Accel X, Accel Y, Accel Z, Roll, Timestamp");
   dataFile.close();
 }

@@ -72,7 +73,7 @@
     sdWrite(accel_event.acceleration.x);
     sdWrite(accel_event.acceleration.y);
     sdWrite(accel_event.acceleration.z);
-    sdWrite(accel_event.orientation.roll);
+    sdWrite(orientation.roll);
     sdWriteNewline();
   }
   closeSd();


update version sign.

update version sign.

--- EspUdpTrigger.ino
+++ EspUdpTrigger.ino
@@ -8,7 +8,7 @@
 #include <EEPROM.h>
 #define MAX_TRIGGER 8
 #define EEPROM_SIZE 512
-#define VERSION "ESP UDP Manager v0.1.4"
+#define VERSION "ESP UDP Trigger v0.1.4"

 const char* device_name = "device";
 const char* path_root   = "/index.html";


Fix JSON API FX change not sending sync (#283)

Rename duplicate effects (#294)
Add India Standard Time
Fix flash on startup
Fix NTP with lwip2

--- wled00/wled05_init.ino
+++ wled00/wled05_init.ino
@@ -26,6 +26,7 @@
   DEBUG_PRINTLN(ESP.getFreeHeap());

   strip.init(EEPROM.read(372),ledCount,EEPROM.read(2204)); //init LEDs quickly
+  strip.setBrightness(0);

   DEBUG_PRINT("LEDs inited. heap usage ~");
   DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
@@ -225,8 +226,7 @@
     udpConnected = notifierUdp.begin(udpPort);
     if (udpConnected && udpRgbPort != udpPort) udpRgbConnected = rgbUdp.begin(udpRgbPort);
   }
-  if (ntpEnabled && WLED_CONNECTED)
-  ntpConnected = ntpUdp.begin(ntpLocalPort);
+  if (ntpEnabled) ntpConnected = ntpUdp.begin(ntpLocalPort);

   initBlynk(blynkApiKey);
   initE131();


Removed wip ino

Removed wip ino

--- Arduino/HelloMesh_OLED_tags.ino/HelloMesh_OLED_tags.ino.ino
+++ Arduino/HelloMesh_OLED_tags.ino/HelloMesh_OLED_tags.ino.ino
@@ -1,101 +0,0 @@
-// Based on the HelloMesh Example
-// Add OLED for debugging messages
-// I have two identical NodeMCUs, both programmed the same, yet one runs slower than the other?
-
-#include <ESP8266WiFi.h>
-#include <ESP8266WiFiMesh.h>
-
-#include <SPI.h>
-#include <Wire.h>
-#include <Adafruit_GFX.h>
-#include <Adafruit_SSD1306.h>
-
-#define OLED_RESET LED_BUILTIN //4
-Adafruit_SSD1306 display(OLED_RESET);
-
-unsigned int request_i = 0;
-unsigned int response_i = 0;
-
-String myName = "Taylor";
-String myNode = String(ESP.getChipId());
-String myData[] = {myName, myNode, "CNC", "3D Printing", "Open Source"};
-int numEntries = 5;   // must match array above
-
-String manageRequest(String request);
-
-/* Create the mesh node object */
-ESP8266WiFiMesh mesh_node = ESP8266WiFiMesh(ESP.getChipId(), manageRequest);
-
-/**
- * Callback for when other nodes send you data
- *
- * @request The string received from another node in the mesh
- * @returns The string to send back to the other node
- */
-String manageRequest(String request)
-{
-  /* Print out received message */
-  // Serial.print("received: ");
-  // Serial.println(request);
-
-  for(int i = 0; i < numEntries; i++){
-    int commaIndex = request.indexOf(',',i);
-    Serial.println(commaIndex);
-  }
-
-  // Display the current chip ID in yellow
-  // Display the incoming message
-  display.clearDisplay();
-  display.setCursor(0,0);
-  display.println(myName);
-  display.setCursor(0,16);
-  display.println(request);
-  display.display();
-
-  /* return a string to send back */
-  String response = ("Hello #" + String(response_i) + " from " + myName);
-  response_i++;
-  return response;
-}
-
-void setup(){
-
-  Serial.begin(115200);
-  delay(10);
-
-  Serial.println();
-  Serial.println();
-  Serial.println("Setting up mesh node...");
-
-  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
-  // empty the buffer
-  display.clearDisplay();
-  display.display();
-  display.setTextSize(1);
-  display.setTextColor(WHITE);
-  display.setCursor(0,0);
-  display.println(myName);
-  display.setCursor(0,16);
-  display.print("Searching...");
-  display.display();
-
-	mesh_node.begin();
-}
-
-void loop()
-{
-  /* Accept any incoming connections */
-  mesh_node.acceptRequest();
-
-  /* Scan for other nodes and send them a message */
-  String request;
-
-  for (int i = sizeof(myData); i > 0; i--){
-    request = request + myData[i] + ",";
-  }
-
-  Serial.println(request);
-  request_i++;
-  mesh_node.attemptScan("hello");
-  delay(5000);
-}


Panorama can now be started via menu, but cannot be stopped until it finishes.

--- gigapanplus.ino
+++ gigapanplus.ino
@@ -80,19 +80,21 @@

 void loop() {
     int event = joystick.read();
-    if (event){
+    if (event && !running){
         handleEvent(event);
+        Serial.println(focal);
+        if (running){   // pano was just started via Menu
+            display.clearDisplay();
+            display.setCursor(0,0);
+            display.print(F("Start "));
+            display.display();
+            pano.setFocalLength(focal);
+            pano.setFOV(horiz, vert);
+            pano.setShutter(shutter, pre_shutter);
+            pano.start();
+        }
     }
-/*
-    display.clearDisplay();
-    display.setCursor(0,0);
-    display.print(F("Start "));
-    display.display();
-    pano.setFocalLength(50);
-    pano.setFOV(180, 90);
-    pano.setShutter(500, 250);
-    pano.start();
-    do {
+    if (running){ // pano is in process
         display.clearDisplay();
         display.setCursor(0,0);
         display.println(F("running\n"));
@@ -104,10 +106,14 @@
         display.print(F("vert = "));
         display.println(pano.vert_position);
         display.display();
-    } while(pano.next());
-    pano.end();
-    display.println(F("end"));
-    display.display();
-    delay(10000);
-*/
+        running = pano.next();
+        if (!running){
+            pano.end();
+            display.println(F("end"));
+            display.display();
+            delay(5000);
+            menu.open();
+            handleEvent(EVENT_NONE);
+        }
+    }
 }


add Moter/LED Control by serial1

add Moter/LED Control by serial1

add LED Control by USBserial & Moter/LED Control by serial1

--- Software/OpenCM9.04/RovMain/RovMain.ino
+++ Software/OpenCM9.04/RovMain/RovMain.ino
@@ -15,8 +15,7 @@
 #include <Servo.h>

-#define USE_RC_SETUP  1
-
+#define USE_RC_SETUP  0

 #define RC_MOTOR_L    0
 #define RC_MOTOR_C    1
@@ -25,12 +24,15 @@
 #define RC_MOTOR_PIN_L  2
 #define RC_MOTOR_PIN_C  3
 #define RC_MOTOR_PIN_R  5
+#define LED_PIN_L  8
+#define LED_PIN_R  9

 RSP     RovSerial;
 Servo   RovServo[3];

 bool IsConnected;

+void led_setup();
 void rc_setup( void );
 void process_recv_cmd( void );

@@ -50,21 +52,23 @@
   RovServo[RC_MOTOR_C].write(0);
   RovServo[RC_MOTOR_R].write(0);

+  pinMode(LED_PIN_L, PWM);
+  pinMode(LED_PIN_R, PWM);
+
+  analogWrite(LED_PIN_L, 0);
+  analogWrite(LED_PIN_R, 0);

   IsConnected = false;
 }

-
 void loop()
 {
   static uint32_t tTime[8];
-

   //-- 명령어 수신 처리
   //
   process_recv_cmd();
-

   #if USE_RC_SETUP ==  1
   rc_setup();
@@ -100,10 +104,11 @@

+
 void rc_setup( void )
 {
   volatile char ch;
-  volatile static int  rc_pwm_L = 0, rc_pwm_R = 0, rc_pwm_T = 0;
+  volatile static int  rc_pwm_L = 0, rc_pwm_R = 0, rc_pwm_C = 0, led_L = 0, led_R = 0;

   if( Serial.available() )
   {
@@ -111,85 +116,108 @@
     //시동
     if( ch == 'o' )
     {
-      rc_pwm_L = 0, rc_pwm_R = 0, rc_pwm_T = 0;
+      rc_pwm_L = 0, rc_pwm_R = 0, rc_pwm_C = 0;
       RovServo[0].write(rc_pwm_L);
-      RovServo[1].write(rc_pwm_R);
-      RovServo[2].write(rc_pwm_T);
+      RovServo[1].write(rc_pwm_C);
+      RovServo[2].write(rc_pwm_R);
       Serial.println("Start");
     }
     //정지 (시동끄기)
     if( ch == 'p' )
     {
-      rc_pwm_L = 0, rc_pwm_R = 0, rc_pwm_T = 0;
+      rc_pwm_L = 0, rc_pwm_R = 0, rc_pwm_C = 0;
       RovServo[0].write(rc_pwm_L);
-      RovServo[1].write(rc_pwm_R);
-      RovServo[2].write(rc_pwm_T);
+      RovServo[1].write(rc_pwm_C);
+      RovServo[2].write(rc_pwm_R);
       Serial.println("Stop");
     }
     //전진 모터 가속
     if( ch == 'w' )
     {
-      rc_pwm_L = constrain(rc_pwm_L++, 0, 2000);
-      rc_pwm_R = constrain(rc_pwm_R++, 0, 2000);
+      rc_pwm_L = constrain(rc_pwm_L++, 0, 1000);
+      rc_pwm_R = constrain(rc_pwm_R++, 0, 1000);
       RovServo[0].write(rc_pwm_L);
       RovServo[2].write(rc_pwm_R);
-      Serial.println("Left=");
-      Serial.println(rc_pwm_L);
-      Serial.println("Right=");
+      Serial.print("Left=");
+      Serial.print(rc_pwm_L);
+      Serial.print("  Right=");
       Serial.println(rc_pwm_R);
     }
     //전진 모터 감속
     if( ch == 's' )
     {
-      rc_pwm_L = constrain(rc_pwm_L--, 0, 2000);
-      rc_pwm_R = constrain(rc_pwm_R--, 0, 2000);
+      rc_pwm_L = constrain(rc_pwm_L--, 0, 1000);
+      rc_pwm_R = constrain(rc_pwm_R--, 0, 1000);
       RovServo[0].write(rc_pwm_L);
       RovServo[2].write(rc_pwm_R);
-      Serial.println("Left=");
-      Serial.println(rc_pwm_L);
-      Serial.println("Right=");
+      Serial.print("Left=");
+      Serial.print(rc_pwm_L);
+      Serial.print("  Right=");
       Serial.println(rc_pwm_R);
     }
     //좌회전
     if( ch == 'a' )
     {
-      rc_pwm_L = constrain(rc_pwm_L--, 0, 2000);
-      rc_pwm_R = constrain(rc_pwm_R++, 0, 2000);
+      rc_pwm_L = constrain(rc_pwm_L--, 0, 1000);
+      rc_pwm_R = constrain(rc_pwm_R++, 0, 1000);
       RovServo[0].write(rc_pwm_L);    //좌측모터 출력 감소
       RovServo[2].write(rc_pwm_R);    //우측모터 출력 증가
-      Serial.println("Left=");
-      Serial.println(rc_pwm_L);
-      Serial.println("Right=");
+      Serial.print("Left=");
+      Serial.print(rc_pwm_L);
+      Serial.print("  Right=");
       Serial.println(rc_pwm_R);
     }
     //우회전
     if( ch == 'd' )
     {
-      rc_pwm_L = constrain(rc_pwm_L++, 0, 2000);
-      rc_pwm_R = constrain(rc_pwm_R--, 0, 2000);
+      rc_pwm_L = constrain(rc_pwm_L++, 0, 1000);
+      rc_pwm_R = constrain(rc_pwm_R--, 0, 1000);
       RovServo[0].write(rc_pwm_L);   // 좌측모터 출력 증가
       RovServo[2].write(rc_pwm_R);    //우측모터 출력 감소
-      Serial.println("Left=");
-      Serial.println(rc_pwm_L);
-      Serial.println("Right=");
+      Serial.print("Left=");
+      Serial.print(rc_pwm_L);
+      Serial.print("  Right=");
       Serial.println(rc_pwm_R);
     }
     //상단모터 가속
     if( ch == 'q' )
     {
-      rc_pwm_T = constrain(rc_pwm_T++, 0, 2000);
-      RovServo[1].write(rc_pwm_T);
-      Serial.println("Top=");
-      Serial.println(rc_pwm_T);
+      rc_pwm_C = constrain(rc_pwm_C++, 0, 1000);
+      RovServo[1].write(rc_pwm_C);
+      Serial.print("Center=");
+      Serial.println(rc_pwm_C);
     }
     //상단모터 감속
     if( ch == 'e' )
     {
-      rc_pwm_T = constrain(rc_pwm_T--, 0, 2000);
-      RovServo[1].write(rc_pwm_T);
-      Serial.println("Top=");
-      Serial.println(rc_pwm_T);
-    }
+      rc_pwm_C = constrain(rc_pwm_C--, 0, 1000);
+      RovServo[1].write(rc_pwm_C);
+      Serial.print("Center=");
+      Serial.println(rc_pwm_C);
+    }
+    if(ch == 'b')
+    {
+      led_L = constrain(led_L+=255, 0, 65535);
+      led_R = constrain(led_R+=255, 0, 65535);
+      analogWrite(LED_PIN_L, led_L);
+      analogWrite(LED_PIN_R, led_R);
+      Serial.print("brighteness++");
+      Serial.print(led_L);
+      Serial.print("+++");
+      Serial.println(led_R);
+    }
+    if(ch == 'v')
+    {
+      led_L = constrain(led_L-=255, 0, 65535);
+      led_R = constrain(led_R-=255, 0, 65535);
+      analogWrite(LED_PIN_L, led_L);
+      analogWrite(LED_PIN_R, led_R);
+      Serial.println("brighteness--");
+      Serial.print(led_L);
+      Serial.print("+++");
+      Serial.println(led_R);
+    }
+
   }

 }
@@ -200,7 +228,6 @@
   uint8_t i;
   RSP_CMD_OBJ    *pCmd;
   static uint32_t tTime;
-

   Ret = RovSerial.update();

@@ -244,8 +271,6 @@
   }
 }

-
-
 void send_cmd_info( void )
 {
   RSP_CMD_OBJ Cmd;
@@ -257,20 +282,52 @@
   RovSerial.SendCmd( &Cmd );
 }

-
-
 void recv_cmd_control( RSP_CMD_OBJ *pCmd )
 {
-  uint16_t Pwm[3];
-
+  uint16_t Pwm[3], Led[2];
+
   //-- 모터 제어
-  //
-  Pwm[0] = (pCmd->Data[8]<<8) | (pCmd->Data[7]);
-  Serial.print("RC : ");
-  Serial.println(Pwm[0]);
-  RovServo[RC_MOTOR_L].write(Pwm[0]);
-
+  //Moter_Left
+  if(pCmd->Data[6] == 0x01)
+  {
+    Pwm[0] = (pCmd->Data[8]<<8) | (pCmd->Data[7]);
+    Serial.print("Moter_L : ");
+    Serial.println(Pwm[0]);
+    RovServo[RC_MOTOR_L].write(Pwm[0]);
+  }
+  //Moter_Center
+  if(pCmd->Data[9] == 0x01)
+  {
+    Pwm[1] = (pCmd->Data[11]<<8) | (pCmd->Data[10]);
+    Serial.print("Moter_C : ");
+    Serial.println(Pwm[1]);
+    RovServo[RC_MOTOR_C].write(Pwm[1]);
+  }
+  //Moter_Right
+  if(pCmd->Data[12] == 0x01)
+  {
+    Pwm[2] = (pCmd->Data[14]<<8) | (pCmd->Data[13]);
+    Serial.print("Moter_R : ");
+    Serial.println(Pwm[2]);
+    RovServo[RC_MOTOR_R].write(Pwm[2]);
+  }
+

   //-- LED 제어
-  //
-}
+  //Led_Left
+  if(pCmd->Data[0] == 0x01)
+  {
+    Led[0] = (pCmd->Data[2]<<8) | (pCmd->Data[1]);
+    Serial.print("Led_L : ");
+    Serial.println(Led[0]);
+    analogWrite(LED_PIN_L, Led[0]);
+  }
+  //Led_Right
+  if(pCmd->Data[3] == 0x01)
+  {
+    Led[1] = (pCmd->Data[5]<<8) | (pCmd->Data[4]);
+    Serial.print("Led_R : ");
+    Serial.println(Led[1]);
+    analogWrite(LED_PIN_R, Led[1]);
+  }
+}


Joystick moves all systems

Joystick moves all systems

--- Elcano_C2_Go/Elcano_C2_Go.ino
+++ Elcano_C2_Go/Elcano_C2_Go.ino
@@ -16,8 +16,8 @@
 #define FALSE 0
 #endif
 #define MEG 1000000
-#define DEBUG 1
-#define DEBUG_M 2
+//#define DEBUG 1
+//#define DEBUG_M 2

 volatile int SpeedCyclometer_degPs;  // 20 mph is about 2000 deg / sec
 // Values to send over DAC
@@ -391,7 +391,7 @@
         initialize();

 //  twitch moves Motor, Brakes and Steering.  5/23/13  TCF
-       twitch();
+//       twitch();
      BrakeOff();
      Serial.println("Initialized");

@@ -400,8 +400,8 @@
 {

   CalibrateBrakes(500);
-  CalibrateSteering(HardRight,3);
-  CalibrateSteering(HardLeft,3);
+  CalibrateSteering(HardRight,10);
+  CalibrateSteering(HardLeft,10);
     DACRamp(200);
 }
 /*---------------------------------------------------------------------------------------*/
@@ -611,7 +611,7 @@
      Serial.print(" FB: "); Serial.print(Instrument[Brakes].Feedback);
      Serial.print(" Brakes: "); Serial.print(desired_position);
   }
-//  Instrument[Brakes].go(desired_position);
+  Instrument[Brakes].go(desired_position);

  // apply steering
@@ -622,7 +622,7 @@
      Serial.print(" FB: "); Serial.print(Instrument[Steering].Feedback);
      Serial.print(" Steering: "); Serial.print(desired_position);
   }
-//  Instrument[Steering].go(desired_position);
+  Instrument[Steering].go(desired_position);
   if (Instrument[Motor].StickMoved || Instrument[Brakes].StickMoved ||
      Instrument[Steering].StickMoved)
      Serial.println(" ");


Delete C_xxMULT-Industruino.ino

Delete C_xxMULT-Industruino.ino

--- Examples/C_xxMULT-Industruino/C_xxMULT-Industruino.ino
+++ Examples/C_xxMULT-Industruino/C_xxMULT-Industruino.ino
@@ -1,363 +0,0 @@
-/* ------------------------------------------------------------------------------------------------------------------------------------------*
- * SE2R : T_COMULT - Fonction de multiplexage d'un tableau de 16 booléens dans un entier non signé               (Compatible IFS) 19/10/2016 *
- * ------------------------------------------------------------------------------------------------------------------------------------------*
- *        T_COMULT(int MPX[], int RNG, Boolean FLG[], int CFG)                                                                    19/10/2016 *
- *                MPX : [00] : Entier, Variable porteuse des booléens multiplexés, forcément un tableau de taille au moins 1                 *
- *                RNG : Entier, rang de la variable porteuse dans le tableau des variables porteuses                                         *
- *                FLG : [00] Booléen de rang 0 dans le tableau de taille 16                                                                  *
- *                      [..] Suite du tableau de booléens à multiplexer                                                                      *
- *                      [15] Dernier booléen du tableau à multiplexer                                                                        *
- *                CFG : Commande de forçage                                                                                *
- *                      <0  : la sortie MPX[RNG] reste nulle quelle que soit la valeur des FLG[...]                                          *
- *                      0   : la sortie MPX[RNG] reste figée à sa valeur courante                                                            *
- *                      1   : la sortie MPX[RNG] suit les valeurs de FLG[...] encodés suivant les puissances de 2                            *
- *                      2   : la sortie MPX[RNG] prend pour valeur 65535                                                                     *
- *                      3   : la sortie MPX[RNG] prend pour valeur 65535                                                                     *
- *                      >3  : la sortie MPX[RNG] reste nulle quelle que soit la valeur des FLG[...]                                          *
- *       Interne  NUM : [00] Calcul intermédiaire d'addition des puissances de 2                                                             *
- * ------------------------------------------------------------------------------------------------------------------------------------------*
- * Copyright SE2R under the APACHE Licence                                                                                *
- * ------------------------------------------------------------------------------------------------------------------------------------------*
- * 19/10/2016 : DD, SE2R : Testée et validée sur banc 32U8, 1286, Arduino Leonardo                                                           *
- * ------------------------------------------------------------------------------------------------------------------------------------------*/
-
- /* ------------------------------------------------------------------------------------------------------------------------------------------*
- * SE2R : T_DEMULT - Fonction de démultiplexage d'un entier non signé dans un tableau de booléens                (Compatible IFS) 19/10/2016 *
- * ------------------------------------------------------------------------------------------------------------------------------------------*
- *        T_DEMULT(int MPX[], int RNG, Boolean FLG[], int CFG)                                                                    19/10/2016 *
- *                MPX : [00] : Entier, Variable porteuse des booléens multiplexés, forcément un tableau de taille au moins 1                 *
- *                RNG : Entier, rang de la variable porteuse dans le tableau des variables porteuses                                         *
- *                FLG : [00] : Booléen de rang 0 dans le tableau                                                                             *
- *                      [..] : Suite du tableau de booléens à multiplexer                                                                    *
- *                      [15] : Dernier booléen du tableau à multiplexer                                                                      *
- *                CFG : Commande de forçage                                                                                *
- *                      <0  : les booléens FLG[xx] restent false quelle que soit la valeur de MPX[RNG]                                       *
- *                      0   : les booléens FLG[xx] restent figés à leur valeur courante                                                      *
- *                      1   : les booléens FLG[xx] suivent les valeurs de MPX[RNG] décodé suivant les puissances de 2                        *
- *                      2   : les booléens FLG[xx] restent true quelle que soit la valeur de MPX[RNG]                                        *
- *                      3   : les booléens FLG[xx] restent true quelle que soit la valeur de MPX[RNG]                                        *
- *                      >3  : les booléens FLG[xx] restent false quelle que soit la valeur de MPX[RNG]                                       *
- *       Interne  NUM : [00] Calcul intermédiaire de décodage des puissances de 2                                                            *
- * ------------------------------------------------------------------------------------------------------------------------------------------*
- * Copyright SE2R under the APACHE Licence                                                                                *
- * ------------------------------------------------------------------------------------------------------------------------------------------*
- * 19/10/2016 : DD, SE2R : Testée et validée sur banc                                                                                *
- * ------------------------------------------------------------------------------------------------------------------------------------------*/
-
-// Déclaration des bibliothèques nécessaires à l'exécution du programme ---------------------------------------------------------------------*
-#include <Wire.h>			// Biblio   - Gestion des ports de communication
-#include <Indio.h>			// Biblio   - Industruino
-#include <DIS.h>                        // Biblio   - SE2R - Fonctions de dialogue et d'affichage sur l'écran UC1701 Industruino
-static DIS DIS;                         // Biblio   - Activation du constructeur de la bibliothèque de fonctions d'affichage
-static UC1701 lcd;
-#include <BMS.h>                        // Biblio   - SE2R - Fonctions de contrôle et régulation
-static BMS BMS;                         // Biblio   - Activation du constructeur de la bibliothèque de fonctions d'affichage
-
-// Déclaration des variables nécessaires à l'exécution de la fonction -----------------------------------------------------------------------*
-boolean FTM_BOOL[16];			// EEPROM  -  Table commune de codage / décodage des booléens savegardés en EEPROM
-boolean FCX_INPT[16];			// Général  - [00] Valeur digitale d'entrée  0
-					//	      [01] Valeur digitale d'entrée  1
-					//	      [02] Valeur digitale d'entrée  2
-					//	      [03] Valeur digitale d'entrée  3
-					//	      [04] Valeur digitale d'entrée  4
-					//	      [05] Valeur digitale d'entrée  5
-					//	      [06] Valeur digitale d'entrée  6
-					//	      [07] Valeur digitale d'entrée  7
-					//	      [08] Valeur digitale d'entrée  8
-					//	      [09] Valeur digitale d'entrée  9
-					//	      [10] Valeur digitale d'entrée 10
-					//	      [11] Valeur digitale d'entrée 11
-					//	      [12] Valeur digitale d'entrée 12
-					//	      [13] Valeur digitale d'entrée 13
-					//	      [14] Valeur digitale d'entrée 14
-					//	      [15] Valeur digitale d'entrée 15
-boolean FCX_OUTP[16];			// Général  - [00] Valeur digitale de sortie  0
-					//	      [01] Valeur digitale de sortie  1
-					//	      [02] Valeur digitale de sortie  2
-					//	      [03] Valeur digitale de sortie  3
-					//	      [04] Valeur digitale de sortie  4
-					//	      [05] Valeur digitale de sortie  5
-					//	      [06] Valeur digitale de sortie  6
-					//	      [07] Valeur digitale de sortie  7
-					//	      [08] Valeur digitale de sortie  8
-					//	      [09] Valeur digitale de sortie  9
-					//	      [10] Valeur digitale de sortie 10
-					//	      [11] Valeur digitale de sortie 11
-					//	      [12] Valeur digitale de sortie 12
-					//	      [13] Valeur digitale de sortie 13
-					//	      [14] Valeur digitale de sortie 14
-					//	      [15] Valeur digitale de sortie 15
-unsigned int VTM_BOOL[4];		// EEPROM   - Table de sauvegarde des booléens (par série de 16)
-unsigned int VCM_MUIN[1];		// EEPROM   - [00] Valeur de lecture de variables de type insigned int en EEPROM
-int VCO_XXXX[1];                        // C_DISCOR - [00] Commande de forçage par l'extérieur
-
-// Déclaration des variables nécessaires au fonctionnement de l'écran -----------------------------------------------------------------------*
-boolean FCO_PRUP[5];                    // EcranLCD - Information de touche "Up" appuyée
-boolean FCO_PREN[5];                    // EcranLCD - Information de touche "Enter" appuyée
-boolean FCO_PRDN[5];                    // EcranLCD - Information de touche "Down" appuyée
-int VNT_MENU[3];                        // EcranLCD - Table d'adressage des menus
-int VNC_MENU[25];                       // EcranLCD - Table des numéros de menus
-int VNC_PRUP[25];                       // EcranLCD - Table des numéros de menus de destination par la touche "Up"
-int VNC_PREN[25];                       // EcranLCD - Table des numéros de menus de destination par la touche "Enter"
-int VNC_PRDN[25];                       // EcranLCD - Table des numéros de menus de destination par la touche "Down"
-float VTT_SCRN[10];                     // EcranLCD - Table des temporisations
-int VNX_MN02[12];                       // EcranLCD - Table des menus de destimation et des index du menu 02 - Principal
-boolean FCM_IN00[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  0
-boolean FCM_IN01[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  1
-boolean FCM_IN02[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  2
-boolean FCM_IN03[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  3
-boolean FCM_IN04[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  4
-boolean FCM_IN05[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  5
-boolean FCM_IN06[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  6
-boolean FCM_IN07[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  7
-boolean FCM_IN08[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  8
-boolean FCM_IN09[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée  9
-boolean FCM_IN10[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée 10
-boolean FCM_IN11[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée 11
-boolean FCM_IN12[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée 12
-boolean FCM_IN13[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée 13
-boolean FCM_IN14[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée 14
-boolean FCM_IN15[1];                    // G_MODV1B - Mémoire de la commande du bit d'entrée 15
-
-void setup() {                          // Initialisation -----------------------------------------------------------------------------------*
-
-EEPROM.get(18, VTM_BOOL[0]);
-BMS.T_DEMULT(VTM_BOOL, 0, FTM_BOOL, 1);
-FCX_INPT[0] = FTM_BOOL[0];
-FCX_INPT[1] = FTM_BOOL[1];
-FCX_INPT[2] = FTM_BOOL[2];
-FCX_INPT[3] = FTM_BOOL[3];
-FCX_INPT[4] = FTM_BOOL[4];
-FCX_INPT[5] = FTM_BOOL[5];
-FCX_INPT[6] = FTM_BOOL[6];
-FCX_INPT[7] = FTM_BOOL[7];
-FCX_INPT[8] = FTM_BOOL[8];
-FCX_INPT[9] = FTM_BOOL[9];
-FCX_INPT[10] = FTM_BOOL[10];
-FCX_INPT[11] = FTM_BOOL[11];
-FCX_INPT[12] = FTM_BOOL[12];
-FCX_INPT[13] = FTM_BOOL[13];
-FCX_INPT[14] = FTM_BOOL[14];
-FCX_INPT[15] = FTM_BOOL[15];
-
-VTT_SCRN[1] = 180;                      // G_TOUCHx - Temporisation d'inactivité sur le rétroéclairage
-VTT_SCRN[2] = 240;                      // G_TOUCHx - Temporisation d'inactivité de retour à l'écran principal
-VTT_SCRN[3] = 20;                       // G_TOUCHx - Temporisation d'antirebond de la touche "Enter"
-VTT_SCRN[4] = 15;                       // G_TOUCHx - Temporisation d'antiredond des touches "Up" et "Down"
-VNT_MENU[0] = 22;                       // G_NAVIGM - Taille des tables d'index et de destinations
-VNT_MENU[1] = 1;                        // G_NAVIGM - Initialisation du pointeur de destinations
-
-//                                      // G_NAVIGM - Tables d'adressage de l'écran LCD
-VNC_MENU[0] = 1;
-VNC_MENU[1] = 1;
-VNC_MENU[2] = 2;
-VNC_MENU[3] = 11;
-VNC_MENU[4] = 12;
-VNC_MENU[5] = 13;
-VNC_MENU[6] = 14;
-VNC_MENU[7] = 15;
-VNC_MENU[8] = 16;
-VNC_MENU[9] = 17;
-VNC_MENU[10] = 18;
-VNC_MENU[11] = 19;
-VNC_MENU[12] = 20;
-VNC_MENU[13] = 21;
-VNC_MENU[14] = 22;
-VNC_MENU[15] = 23;
-VNC_MENU[16] = 24;
-VNC_MENU[17] = 25;
-VNC_MENU[18] = 26;
-VNC_MENU[19] = 27;
-VNC_MENU[20] = 28;
-VNC_MENU[21] = 29;
-VNC_MENU[22] = 30;
-VNC_PRUP[1] =   1; VNC_PREN[1] =    2; VNC_PRDN[1] =   2;
-VNC_PRUP[2] =   2; VNC_PREN[2] =    2; VNC_PRDN[2] =   2;
-VNC_PRUP[3] =   11; VNC_PREN[3] =  12; VNC_PRDN[3] =  11;
-VNC_PRUP[4] =   12; VNC_PREN[4] =  13; VNC_PRDN[4] =  12;
-VNC_PRUP[5] =   13; VNC_PREN[5] =  14; VNC_PRDN[5] =  13;
-VNC_PRUP[6] =   14; VNC_PREN[6] =  15; VNC_PRDN[6] =  14;
-VNC_PRUP[7] =   15; VNC_PREN[7] =  16; VNC_PRDN[7] =  15;
-VNC_PRUP[8] =   16; VNC_PREN[8] =  17; VNC_PRDN[8] =  16;
-VNC_PRUP[9] =   17; VNC_PREN[9] =  18; VNC_PRDN[9] =  17;
-VNC_PRUP[10] =  18; VNC_PREN[10] =  2; VNC_PRDN[10] = 18;
-VNC_PRUP[11] =   2; VNC_PREN[11] =  2; VNC_PRDN[11] =  2;
-VNC_PRUP[12] =   2; VNC_PREN[12] =  2; VNC_PRDN[12] =  2;
-VNC_PRUP[13] =  21; VNC_PREN[13] = 22; VNC_PRDN[13] = 21;
-VNC_PRUP[14] =  22; VNC_PREN[14] = 23; VNC_PRDN[14] = 22;
-VNC_PRUP[15] =  23; VNC_PREN[15] = 24; VNC_PRDN[15] = 23;
-VNC_PRUP[16] =  24; VNC_PREN[16] = 25; VNC_PRDN[16] = 24;
-VNC_PRUP[17] =  25; VNC_PREN[17] = 26; VNC_PRDN[17] = 25;
-VNC_PRUP[18] =  26; VNC_PREN[18] = 27; VNC_PRDN[18] = 26;
-VNC_PRUP[19] =  27; VNC_PREN[19] = 28; VNC_PRDN[19] = 27;
-VNC_PRUP[20] =  28; VNC_PREN[20] =  2; VNC_PRDN[20] = 28;
-VNC_PRUP[21] =   2; VNC_PREN[21] =  2; VNC_PRDN[21] =  2;
-VNC_PRUP[22] =   2; VNC_PREN[22] =  2; VNC_PRDN[22] =  2;
-
-VNX_MN02[10] = 1;			// G_CHOIX8 - Menu 02 - Initialisation index
-
-//                                      // EcranLCD - Paramétrage spécifique Industruino 1286
-pinMode(23, INPUT);                     // EcranLCD - Spécifique 1286 - Touche flèche basse
-pinMode(24, INPUT);                     // EcranLCD - Spécifique 1286 - Touche entrée
-pinMode(25, INPUT);                     // EcranLCD - Spécifique 1286 - Touche flèche haute
-pinMode(26, OUTPUT);                    // EcranLCD - Spécifique 1286 - Sortie de commande du rétroéclairage
-
-/*                                      // EcranLCD - Paramétrage spécifique Industruino 32U8
-pinMode(13, OUTPUT);                    // EcranLCD - Spécifique 32U8 - Sortie de commande du rétroéclairage
-*/
-lcd.begin();                            // EcranLCD - Initialisation de l'écran LCD
-lcd.clear();                            // EcranLCD - Effacement de l'écran LCD
-}
-
-void loop() {                            // Exécution ---------------------------------------------------------------------------------------*
-FTM_BOOL[0] = FCX_INPT[0];
-FTM_BOOL[1] = FCX_INPT[1];
-FTM_BOOL[2] = FCX_INPT[2];
-FTM_BOOL[3] = FCX_INPT[3];
-FTM_BOOL[4] = FCX_INPT[4];
-FTM_BOOL[5] = FCX_INPT[5];
-FTM_BOOL[6] = FCX_INPT[6];
-FTM_BOOL[7] = FCX_INPT[7];
-FTM_BOOL[8] = FCX_INPT[8];
-FTM_BOOL[9] = FCX_INPT[9];
-FTM_BOOL[10] = FCX_INPT[10];
-FTM_BOOL[11] = FCX_INPT[11];
-FTM_BOOL[12] = FCX_INPT[12];
-FTM_BOOL[13] = FCX_INPT[13];
-FTM_BOOL[14] = FCX_INPT[14];
-FTM_BOOL[15] = FCX_INPT[15];
-BMS.T_COMULT(VTM_BOOL, 0, FTM_BOOL, 1);
-
-EEPROM.get(18, VTM_BOOL[1]);
-if (VTM_BOOL[1] != VTM_BOOL[0]) { EEPROM.put(18, VTM_BOOL[0]); }
-EEPROM.get(18, VTM_BOOL[1]);
-
-BMS.T_DEMULT(VTM_BOOL, 1, FTM_BOOL, 1);
-FCX_OUTP[0] = FTM_BOOL[0];
-FCX_OUTP[1] = FTM_BOOL[1];
-FCX_OUTP[2] = FTM_BOOL[2];
-FCX_OUTP[3] = FTM_BOOL[3];
-FCX_OUTP[4] = FTM_BOOL[4];
-FCX_OUTP[5] = FTM_BOOL[5];
-FCX_OUTP[6] = FTM_BOOL[6];
-FCX_OUTP[7] = FTM_BOOL[7];
-FCX_OUTP[8] = FTM_BOOL[8];
-FCX_OUTP[9] = FTM_BOOL[9];
-FCX_OUTP[10] = FTM_BOOL[10];
-FCX_OUTP[11] = FTM_BOOL[11];
-FCX_OUTP[12] = FTM_BOOL[12];
-FCX_OUTP[13] = FTM_BOOL[13];
-FCX_OUTP[14] = FTM_BOOL[14];
-FCX_OUTP[15] = FTM_BOOL[15];
-
-//                                      // EcranLCD - Gestion des touches spécifique Industruino 1286
-DIS.G_TOUCH2(VNC_MENU, VTT_SCRN, FCO_PRUP, FCO_PREN, FCO_PRDN, VNT_MENU);
-/*                                      // EcranLCD - Gestion des touches spécifique Industruino 32U8
-DIS.G_TOUCH1(VNC_MENU, VTT_SCRN, FCO_PRUP, FCO_PREN, FCO_PRDN, VNT_MENU);
-*/
-
-if (VNT_MENU[2] != VNC_MENU[0]) { lcd.clear(); }
-VNT_MENU[2] = VNC_MENU[0];
-
-if (VNC_MENU[0] ==  1) { lcd.setCursor(0, 0); lcd.clearLine(); }
-DIS.G_MESS1L(VNC_MENU, 1, 1, 0, "   www.eControls.fr  ");
-DIS.G_MESS1L(VNC_MENU, 1, 2, 0, "    SE2R Softwares   ");
-DIS.G_MESS1L(VNC_MENU, 1, 3, 0, "  Industruino  1286  ");
-// DIS.G_MESS1L(VNC_MENU, 1, 3, 0, "  Industruino  32U8  ");
-DIS.G_MESS1L(VNC_MENU, 1, 4, 0, "Fonction BMS.T_COMULT");
-DIS.G_MESS1L(VNC_MENU, 1, 5, 0, "Fonction BMS.T_DEMULT");
-DIS.G_MESS1L(VNC_MENU, 1, 6, 0, "A# TESTS     C# 00001");
-DIS.G_MESS1L(VNC_MENU, 1, 7, 0, "V.1.02     19/10/2016");
-
-VNX_MN02[0] = 0;
-VNX_MN02[1] = 1;
-VNX_MN02[2] = 11;
-VNX_MN02[3] = 21;
-VNX_MN02[4] = 0;
-VNX_MN02[5] = 0;
-VNX_MN02[6] = 0;
-VNX_MN02[7] = 0;
-VNX_MN02[8] = 1;
-VNX_MN02[9] = 3;
-DIS.G_CHOIX8(VNC_MENU, 2, FCO_PRUP, FCO_PREN, FCO_PRDN, VNX_MN02, VNT_MENU);
-DIS.G_MESS1L(VNC_MENU, 2, 0, 0, "- Etats & commandes -");
-DIS.G_MESS1L(VNC_MENU, 2, 1, 6,  "Retour a l'accueil  ");
-DIS.G_MESS1L(VNC_MENU, 2, 2, 6,  "Bits d'entree 00-07 ");
-DIS.G_MESS1L(VNC_MENU, 2, 3, 6,  "Bits d'entree 08-15 ");
-DIS.G_MESS1L(VNC_MENU, 2, 4, 0, "In   ");
-DIS.G_MESS1L(VNC_MENU, 2, 5, 0, "Out  ");
-DIS.G_MESS1L(VNC_MENU, 2, 6, 0, "Porteuse             ");
-DIS.G_MESS1L(VNC_MENU, 2, 7, 0, "EEPROM               ");
-if (VNC_MENU[0] == 2) {
-  lcd.setCursor(122, 4); if (FCX_INPT[0] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(116, 4); if (FCX_INPT[1] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(110, 4); if (FCX_INPT[2] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(104, 4); if (FCX_INPT[3] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 98, 4); if (FCX_INPT[4] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 92, 4); if (FCX_INPT[5] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 86, 4); if (FCX_INPT[6] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 80, 4); if (FCX_INPT[7] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 74, 4); if (FCX_INPT[8] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 68, 4); if (FCX_INPT[9] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 62, 4); if (FCX_INPT[10] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 56, 4); if (FCX_INPT[11] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 50, 4); if (FCX_INPT[12] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 44, 4); if (FCX_INPT[13] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 38, 4); if (FCX_INPT[14] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 32, 4); if (FCX_INPT[15] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(122, 5); if (FCX_OUTP[0] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(116, 5); if (FCX_OUTP[1] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(110, 5); if (FCX_OUTP[2] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor(104, 5); if (FCX_OUTP[3] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 98, 5); if (FCX_OUTP[4] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 92, 5); if (FCX_OUTP[5] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 86, 5); if (FCX_OUTP[6] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 80, 5); if (FCX_OUTP[7] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 74, 5); if (FCX_OUTP[8] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 68, 5); if (FCX_OUTP[9] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 62, 5); if (FCX_OUTP[10] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 56, 5); if (FCX_OUTP[11] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 50, 5); if (FCX_OUTP[12] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 44, 5); if (FCX_OUTP[13] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 38, 5); if (FCX_OUTP[14] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 32, 5); if (FCX_OUTP[15] == true) { lcd.print("1"); } else {lcd.print("0"); }
-  lcd.setCursor( 80, 6); lcd.print(VTM_BOOL[0]);
-  lcd.setCursor( 80, 7); lcd.print(VTM_BOOL[1]);
-  FCM_IN00[0] = FCX_INPT[0];
-  FCM_IN01[0] = FCX_INPT[1];
-  FCM_IN02[0] = FCX_INPT[2];
-  FCM_IN03[0] = FCX_INPT[3];
-  FCM_IN04[0] = FCX_INPT[4];
-  FCM_IN05[0] = FCX_INPT[5];
-  FCM_IN06[0] = FCX_INPT[6];
-  FCM_IN07[0] = FCX_INPT[7];
-  FCM_IN08[0] = FCX_INPT[8];
-  FCM_IN09[0] = FCX_INPT[9];
-  FCM_IN10[0] = FCX_INPT[10];
-  FCM_IN11[0] = FCX_INPT[11];
-  FCM_IN12[0] = FCX_INPT[12];
-  FCM_IN13[0] = FCX_INPT[13];
-  FCM_IN14[0] = FCX_INPT[14];
-  FCM_IN15[0] = FCX_INPT[15];
-  }
-
-DIS.G_MODV1B(VNC_MENU, 11, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  0, FCM_IN00, "-  Bit d'entree 00  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 12, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  1, FCM_IN01, "-  Bit d'entree 01  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 13, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  2, FCM_IN02, "-  Bit d'entree 02  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 14, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  3, FCM_IN03, "-  Bit d'entree 03  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 15, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  4, FCM_IN04, "-  Bit d'entree 04  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 16, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  5, FCM_IN05, "-  Bit d'entree 05  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 17, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  6, FCM_IN06, "-  Bit d'entree 06  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 18, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  7, FCM_IN07, "-  Bit d'entree 07  -" , "- Changer de valeur -", " Off ", "  On ", true);
-
-DIS.G_MODV1B(VNC_MENU, 21, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  8, FCM_IN08, "-  Bit d'entree 08  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 22, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT,  9, FCM_IN09, "-  Bit d'entree 09  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 23, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT, 10, FCM_IN10, "-  Bit d'entree 10  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 24, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT, 11, FCM_IN11, "-  Bit d'entree 11  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 25, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT, 12, FCM_IN12, "-  Bit d'entree 12  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 26, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT, 13, FCM_IN13, "-  Bit d'entree 13  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 27, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT, 14, FCM_IN14, "-  Bit d'entree 14  -" , "- Changer de valeur -", " Off ", "  On ", true);
-DIS.G_MODV1B(VNC_MENU, 28, FCO_PRUP, FCO_PREN, FCO_PRDN, FCX_INPT, 15, FCM_IN15, "-  Bit d'entree 15  -" , "- Changer de valeur -", " Off ", "  On ", true);
-
-DIS.G_NAVIGM(VNC_MENU, VNT_MENU, FCO_PRUP, FCO_PREN, FCO_PRDN , VNC_PRUP, VNC_PREN, VNC_PRDN);
-}


Fix the debug macros

Fix the debug macros

--- Event_Printer/Event_Printer.ino
+++ Event_Printer/Event_Printer.ino
@@ -12,13 +12,13 @@
 #define LO_NIBBLE(b) ((b) & 0x0F)

 /* Debug Macros */
-#if DEBUG
-#define DEBUG_PRINT(x,...)    Serial.print(x,__VA_ARGS__)
-#define DEBUG_PRINT_LN(x,...) Serial.println(x,__VA_ARGS__)
+#ifdef DEBUG
+    #define DEBUG_PRINT(...) Serial.print(__VA_ARGS__)
+    #define DEBUG_PRINT_LN(...) Serial.println(__VA_ARGS__)
 #else
-#define DEBUG_PRINT(x,...)
-#define DEBUG_PRINT_LN(x,...)
-#endif // DEBUG
+    #define DEBUG_PRINT(...)
+    #define DEBUG_PRINT_LN(...)
+#endif

 MCP_CAN CAN(9);


v5.4 Add additional comments

v5.4 Add additional comments

--- PictureViewer.ino
+++ PictureViewer.ino
@@ -282,7 +282,7 @@

 uint8_t read8(File f) {
   uint8_t result;
-  ((uint8_t *)&result)[0] = f.read();
+  ((uint8_t *)&result)[0] = f.read(); // One byte
   return result;
 }

@@ -302,7 +302,7 @@
   return result;
 }

-// Displays the splach screen
+// Displays the splash screen
 void displaySplashScreen(displayModeEnum displayMode) {
   tft.setTextWrap(false);
   tft.fillScreen(ST7735_BLACK);
@@ -396,7 +396,8 @@
   }
   tft.setCursor(0, 15);
   tft.println("Theme:");
-  maxLeghtOfTheme = min(themeField.length(), MAXTHEMELENGTH);
+  // Center the theme
+  maxLeghtOfTheme = min(themeField.length(), MAXTHEMELENGTH); // Limit characters
   tft.setCursor((HALFTHEMELENGTH - (maxLeghtOfTheme / 2)) * LCDWIDTHOFFSET, 25);
   tft.println(themeField);
   tft.setCursor(0, 50);


Added spiral path, life, and pulse patterns. Fixed brightness glitch (can't use uint8_t as Particle Cloud variable). Added ice palette.

--- fibonacci.ino
+++ fibonacci.ino
@@ -2,6 +2,7 @@
 FASTLED_USING_NAMESPACE;

 #include "application.h"
+#include "math.h"

 #define ONE_DAY_MILLIS (24 * 60 * 60 * 1000)

@@ -32,7 +33,10 @@
   { horizontalPaletteBlend, "Horizontal Palette Shift" },
   { spiral1,                "Spiral 1" },
   { spiral2,                "Spiral 2" },
+  { spiralPath1,            "Spiral Path 1" },
   { wave,                   "Wave" },
+  { life,                   "Life" },
+  { pulse,                  "Pulse" },
   { rainbow,                "Rainbow" },
   { rainbowWithGlitter,     "Rainbow With Glitter" },
   { confetti,               "Confetti" },
@@ -47,7 +51,7 @@
   { showSolidColor,         "Solid Color" }
 };

-uint8_t brightness = 32;
+int brightness = 32;

 int patternCount = ARRAY_SIZE(patterns);
 int patternIndex = 0;
@@ -59,6 +63,8 @@
 unsigned long lastTimeSync = millis();

 uint8_t gHue = 0; // rotating "base color" used by many of the patterns
+
+CRGBPalette16 icePalette = CRGBPalette16(CRGB::Black, CRGB::Blue, CRGB::Aqua, CRGB::White);

 uint8_t paletteIndex = 0;

@@ -73,6 +79,7 @@
   HeatColors_p,
   LavaColors_p,
   PartyColors_p,
+  icePalette,
 };

 uint8_t paletteCount = ARRAY_SIZE(palettes);
@@ -395,8 +402,6 @@

     return 30;
 }
-
-CRGBPalette16 icePalette = CRGBPalette16(CRGB::Black, CRGB::Blue, CRGB::Aqua, CRGB::White);

 uint8_t water() {
     heatMap(icePalette, false);
@@ -603,6 +608,47 @@
     return 0;
 }

+void spiralPath(uint8_t points[], uint8_t length)
+{
+    static uint8_t currentIndex = 0;
+
+    dimAll(255);
+
+    leds[points[currentIndex]] = ColorFromPalette(currentPalette, gHue, 255, BLEND);
+
+    EVERY_N_MILLIS(20)
+    {
+        currentIndex++;
+
+        if(currentIndex >= length)
+            currentIndex = 0;
+    };
+}
+
+uint8_t spiralPath1Arms[] =
+{
+    11, 25, 38, 51, 64, 74, 83, 65, 40, 28, 2,
+    16, 29, 42, 55, 68, 85, 56, 44, 19, 32, 45,
+    58, 70, 87, 59, 47, 22, 9, 23, 36, 49, 62,
+    72, 91, 63, 38, 13, 26, 39, 52, 65, 75, 91,
+    66, 54, 29, 3, 17, 30, 43, 56, 77, 86, 69,
+    45, 20, 7, 21, 34, 47, 60, 71, 88, 61, 49,
+    24, 37, 50, 63, 73, 82, 64, 39, 14, 1, 15,
+    28, 41, 54, 67, 76, 55, 30, 18, 31, 44, 57,
+    69, 78, 93, 70, 46, 34, 8, 22, 35, 48, 61,
+    80, 89, 90, 73, 51, 26, 0, 14, 27, 40, 53,
+    66, 84, 97, 98, 77, 57, 32, 6, 20, 33, 46,
+    59, 79, 94, 95, 80, 62, 37
+};
+
+const uint8_t spiralPath1Length = ARRAY_SIZE(spiralPath1Arms);
+
+uint8_t spiralPath1()
+{
+    spiralPath(spiralPath1Arms, spiralPath1Length);
+    return 0;
+}
+
 // Params for width and height
 const uint8_t kMatrixWidth = 10;
 const uint8_t kMatrixHeight = 10;
@@ -732,6 +778,196 @@
     theta++;

     return 0;
+}
+
+uint8_t pulse()
+{
+    dimAll(200);
+
+    uint8_t maxSteps = 16;
+    static uint8_t step = maxSteps;
+    static uint8_t centerX = 0;
+    static uint8_t centerY = 0;
+    float fadeRate = 0.8;
+
+    if (step >= maxSteps)
+    {
+        centerX = random(kMatrixWidth);
+        centerY = random(kMatrixWidth);
+        step = 0;
+    }
+
+    if (step == 0)
+    {
+        drawCircle(centerX, centerY, step, ColorFromPalette(currentPalette, gHue, 255, BLEND));
+        step++;
+    }
+    else
+    {
+        if (step < maxSteps)
+        {
+            // initial pulse
+            drawCircle(centerX, centerY, step, ColorFromPalette(currentPalette, gHue, pow(fadeRate, step - 2) * 255, BLEND));
+
+            // secondary pulse
+            if (step > 3) {
+                drawCircle(centerX, centerY, step - 3, ColorFromPalette(currentPalette, gHue, pow(fadeRate, step - 2) * 255, BLEND));
+            }
+
+            step++;
+        }
+        else
+        {
+            step = -1;
+        }
+    }
+
+    return 30;
+}
+
+// algorithm from http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
+void drawCircle(uint8_t x0, uint8_t y0, uint8_t radius, const CRGB color)
+{
+    int a = radius, b = 0;
+    int radiusError = 1 - a;
+
+    if (radius == 0) {
+        setPixelXY(x0, y0, color);
+        return;
+    }
+
+    while (a >= b)
+    {
+        setPixelXY(a + x0, b + y0, color);
+        setPixelXY(b + x0, a + y0, color);
+        setPixelXY(-a + x0, b + y0, color);
+        setPixelXY(-b + x0, a + y0, color);
+        setPixelXY(-a + x0, -b + y0, color);
+        setPixelXY(-b + x0, -a + y0, color);
+        setPixelXY(a + x0, -b + y0, color);
+        setPixelXY(b + x0, -a + y0, color);
+
+        b++;
+        if (radiusError < 0)
+            radiusError += 2 * b + 1;
+        else
+        {
+            a--;
+            radiusError += 2 * (b - a + 1);
+        }
+    }
+}
+
+class Cell
+{
+    public:
+    byte alive : 1;
+    byte prev : 1;
+    byte hue: 6;
+    byte brightness;
+};
+
+Cell world[kMatrixWidth][kMatrixHeight];
+
+uint8_t neighbors(uint8_t x, uint8_t y)
+{
+    return (world[(x + 1) % kMatrixWidth][y].prev) +
+        (world[x][(y + 1) % kMatrixHeight].prev) +
+        (world[(x + kMatrixWidth - 1) % kMatrixWidth][y].prev) +
+        (world[x][(y + kMatrixHeight - 1) % kMatrixHeight].prev) +
+        (world[(x + 1) % kMatrixWidth][(y + 1) % kMatrixHeight].prev) +
+        (world[(x + kMatrixWidth - 1) % kMatrixWidth][(y + 1) % kMatrixHeight].prev) +
+        (world[(x + kMatrixWidth - 1) % kMatrixWidth][(y + kMatrixHeight - 1) % kMatrixHeight].prev) +
+        (world[(x + 1) % kMatrixWidth][(y + kMatrixHeight - 1) % kMatrixHeight].prev);
+}
+
+void randomFillWorld()
+{
+    static uint8_t lifeDensity = 10;
+
+    for (uint8_t i = 0; i < kMatrixWidth; i++) {
+        for (uint8_t j = 0; j < kMatrixHeight; j++) {
+            if (random(100) < lifeDensity) {
+                world[i][j].alive = 1;
+                world[i][j].brightness = 255;
+            }
+            else {
+                world[i][j].alive = 0;
+                world[i][j].brightness = 0;
+            }
+            world[i][j].prev = world[i][j].alive;
+            world[i][j].hue = 0;
+        }
+    }
+}
+
+uint8_t life()
+{
+    static uint8_t generation = 0;
+
+    // Display current generation
+    for (uint8_t i = 0; i < kMatrixWidth; i++)
+    {
+        for (uint8_t j = 0; j < kMatrixHeight; j++)
+        {
+            setPixelXY(i, j, ColorFromPalette(currentPalette, world[i][j].hue * 4, world[i][j].brightness, BLEND));
+        }
+    }
+
+    uint8_t liveCells = 0;
+
+    // Birth and death cycle
+    for (uint8_t x = 0; x < kMatrixWidth; x++)
+    {
+        for (uint8_t y = 0; y < kMatrixHeight; y++)
+        {
+            // Default is for cell to stay the same
+            if (world[x][y].brightness > 0 && world[x][y].prev == 0)
+              world[x][y].brightness *= 0.5;
+
+            uint8_t count = neighbors(x, y);
+
+            if (count == 3 && world[x][y].prev == 0)
+            {
+                // A new cell is born
+                world[x][y].alive = 1;
+                world[x][y].hue += 2;
+                world[x][y].brightness = 255;
+            }
+            else if ((count < 2 || count > 3) && world[x][y].prev == 1)
+            {
+                // Cell dies
+                world[x][y].alive = 0;
+            }
+
+            if(world[x][y].alive)
+                liveCells++;
+        }
+    }
+
+    // Copy next generation into place
+    for (uint8_t x = 0; x < kMatrixWidth; x++)
+    {
+        for (uint8_t y = 0; y < kMatrixHeight; y++)
+        {
+            world[x][y].prev = world[x][y].alive;
+        }
+    }
+
+    if (liveCells < 4 || generation >= 128)
+    {
+        fill_solid(leds, NUM_LEDS, CRGB::Black);
+
+        randomFillWorld();
+
+        generation = 0;
+    }
+    else
+    {
+        generation++;
+    }
+
+    return 60;
 }

 void heatMap(CRGBPalette16 palette, bool up) {


Show digits again

Show digits again

--- countdown/countdown.ino
+++ countdown/countdown.ino
@@ -144,9 +144,9 @@

   // 1: determine the led that is currently 'walking out'
   //    Since each led should take equal time to walk out, this is simply 100*s/T
-  uint8_t current_led = 100-(decasecs / DECASECONDS_PER_LED);
+  uint8_t current_led = ((10*TOTAL_SECONDS - decasecs) / DECASECONDS_PER_LED);
   // 2: determine which of the three colours is moving out
-  uint8_t decasecs_in_led = DECASECONDS_PER_LED - decasecs % DECASECONDS_PER_LED;
+  uint16_t decasecs_in_led = DECASECONDS_PER_LED - decasecs % DECASECONDS_PER_LED;
   uint8_t current_colour = ((uint16_t) decasecs_in_led * 3) / DECASECONDS_PER_LED;
   // 3: determine the position of the current colour
   uint8_t current_pos = current_led-1 - ((decasecs_in_led % DECASECONDS_PER_COLOUR) * current_led) / DECASECONDS_PER_COLOUR;
@@ -205,7 +205,7 @@
 }

-uint16_t decaseconds_left = 10*TOTAL_SECONDS/8;
+uint16_t decaseconds_left = 10*TOTAL_SECONDS/4;

 unsigned long prevStepTime = 0;
@@ -223,18 +223,18 @@
     }*/
     draw_walker(decaseconds_left--);
   }
-  /*
+
   if(millis()-prevCounterTime >= 500){
     prevCounterTime = millis();
-    writeDigits(seconds_left--);
-  }*/
+    writeDigits(decaseconds_left/10);
+  }

   if(millis()-prevUpdateTime >= UPDATE_TIME){
     prevUpdateTime = millis();
     for(uint8_t i_led=0; i_led != NUM_LEDS; ++i_led){
       for(uint8_t i=0; i!=3; ++i)
-        leds[i_led][i] = walker_leds[i_led][i];
-        // leds[i_led][i] = (uint8_t) (((uint16_t)leds[i_led][i]*19 + (uint16_t)walker_leds[i_led][i]/2 + (uint16_t)counter_leds[i_led][i]/3)/20);
+        // leds[i_led][i] = walker_leds[i_led][i];
+        leds[i_led][i] = (uint8_t) (((uint16_t)leds[i_led][i]*19 + (uint16_t)walker_leds[i_led][i]/2 + (uint16_t)counter_leds[i_led][i]/3)/20);
     }
     update();
   }


Lib mit Servo und WIFI Test verbessert

Lib mit Servo und WIFI Test verbessert

--- Arduino_Humidor_Monitoring/Arduino_Humidor_Monitoring.ino
+++ Arduino_Humidor_Monitoring/Arduino_Humidor_Monitoring.ino
@@ -91,6 +91,7 @@
 #include<SoftwareSerial.h>
 SoftwareSerial wifi(2,3); //RX, TX
 boolean NO_IP=false;
+boolean WIFI_CONN=false;
 String IP="";
 int i,k,x=0;

@@ -105,6 +106,7 @@
 int servo_pin = 5;
 // Create a servo object
 Servo servo1;
+int pos = 0;

 //DHT lib
 int dhtPin = 4;
@@ -115,7 +117,7 @@
 //unsigned long stime = 1800000; // Zeit zwischen den Sendezeiten
 //unsigned long mtime = 900000; // Zeit zwischen den Messungen
 unsigned long stime = 20000; // Zeit zwischen den Sendezeiten
-unsigned long mtime = 5000; // Zeit zwischen den Messungen
+unsigned long mtime = 10000; // Zeit zwischen den Messungen

 boolean isopen; // Boolean Feld fuer den Status vom Luefter.

@@ -142,12 +144,13 @@
 #define LOGO16_GLCD_WIDTH  16
 */

-void servo_ctrl(char cmd){
-  if(cmd=='open'){
+void servo_ctrl(char cmd[5]){
+  if(cmd=="open"){
     if(!isopen){
       // servo go to 90 degrees (open)
-      servo1.write(90);
+      servo1.write(130);
       isopen=true;
+      Serial.println(F("Servo Control write 130"));
       delay(1000);
     } else {
       // do nothing
@@ -155,12 +158,20 @@
   } else {
     if(isopen){
       // servo go to 0 degrees (close)
-      servo1.write(0);
+      servo1.write(15);
       isopen=false;
+      Serial.println(F("Servo Control write 15"));
       delay(1000);
     } else {
       // do nothing
     }
+  }
+  // close by setup
+  if(cmd=="start"){
+    servo1.write(15);
+    isopen=false;
+    Serial.println(F("Servo Control write 15"));
+    delay(1000);
   }
 }

@@ -191,6 +202,7 @@
       while(wifi.available()>0){
         if(wifi.find("WIFI GOT IP")){
           NO_IP=true;
+          WIFI_CONN=true;
         }
       }
   }
@@ -219,25 +231,33 @@
     break;
     delay(1000);
   }
-  Serial.print(IP);
-  Serial.print(F("Port:"));
-  Serial.println(80);
+  if(IP==""){
+    // test
+  } else {
+    WIFI_CONN=true;
+    NO_IP=true;
+    Serial.print(IP);
+    Serial.print(F("Port:"));
+    Serial.println(80);
+  }
 }

 void wifi_init(){
   connect_wifi(F("AT"),100);
   connect_wifi(F("AT+CWMODE=1"),100);
   connect_wifi(F("AT+CWQAP"),100);
-  connect_wifi(F("AT+RST"),5000);
+  connect_wifi(F("AT+RST"),10000);
   check_ip(5000);
   if(!NO_IP){
     Serial.println(F("Connecting Wifi..."));
     connect_wifi("AT+CWJAP=\"tlapse\",\"Timelapse-2016\"",7000); //username,password,waittime
   } else {
+    // do nothing
   }
   Serial.println(F("Wifi Connect"));
   //get_ip();
   connect_wifi(F("AT+CIPMUX=0"),100);
+  check_ip(5000);
   //connect_wifi(F("AT+CIPSERVER=1,80"),100);
 }

@@ -245,40 +265,40 @@
 void setup() {
   Serial.begin(115200);
   wifi.begin(115200);
-  wifi_init();
-
+  //wifi_init();
+
   root["ID"] = ID;
   root["sendtime"] = stime;
   root["measuretime"] = mtime;

   // We need to attach the servo to the used pin number
   servo1.attach(servo_pin);
-
-  pinMode(servo_pin, OUTPUT);
-  digitalWrite(servo_pin, LOW);
+  // close servo
+  servo_ctrl("start");

   dht.setup(dhtPin);
+  Serial.println(F("Setup End"));
 }

 unsigned long task1, task2, task3 = 0;
 void loop() {
   unsigned long currmillis = millis();

-  //falls der Luefter laeuft pruefe alle 15 Sekunden die Werte
+  //falls die Befeuchtung aktiv ist pruefe alle 30 Sekunden die Werte
   if (isopen) {
-    if ((unsigned long)(currmillis - task2) >= 15000) {
+    if ((unsigned long)(currmillis - task2) >= 30000) {
       byte i;
       //Serial.println(F("check if hum"));
       if ((float)(get_hum() <= 65.0 || get_hum() <= 70.0)) {
         if (!isopen) {
           //oeffne die Belueftung und starte den Luefter
-          //Serial.println(F("fan ON"));
+          Serial.println(F("Open Slot"));
           servo_ctrl("open");
         }
       } else {
         if (isopen) {
           // switch fan1 off und schliesse den Schlitz
-          //Serial.println(F("fan off"));
+          Serial.println(F("Close Slot"));
           servo_ctrl("close");
         }
       }
@@ -296,31 +316,31 @@
     task1 = millis();
   }

-  // Sende Messdaten wenn die Oeffnungen offen sind alle 30 Sekunden
+  // Sende Messdaten wenn die Befeuchtung aktiv ist alle 60 Sekunden
   if(isopen){
-    if((unsigned long)(currmillis - task3) >= 30000){
+    if((unsigned long)(currmillis - task3) >= 60000){
       //TransmitData(get_temp(), get_hum());
-      root["temperature"] = get_temp();
-      root["Humidity"] = get_hum();
+      root["temperature"]=get_temp();
+      root["Humidity"]=get_hum();
       TransmitData();
       task3 = millis();
     }
   }

-  // checke die Luftfeuchtigkeit und wenn zu niedrig schalte Luefter ein.
+  // checke die Luftfeuchtigkeit und wenn zu niedrig schalte die Befeuchtung ein.
   if ((unsigned long)(currmillis - task2) >= mtime) {
     byte i;
     //Serial.println(F("check if hum"));
     if ((float)(get_hum() <= 65.0 || get_hum() <= 70.0)) {
       if (!isopen) {
         //oeffne die Belueftung und starte den Luefter
-        //Serial.println(F("Switch fan on"));
+        Serial.println(F("Switch fan on"));
         servo_ctrl("open");
       }
     } else {
       if (isopen) {
         // switch fan1 off und schliesse den Schlitz
-        //Serial.println(F("Switch fan off"));
+        Serial.println(F("Switch fan off"));
         servo_ctrl("close");
       }
     }
@@ -328,20 +348,53 @@
   }
 }

+// Read temperature as Celsius (the default)
 float get_temp() {
-  // Read temperature as Celsius (the default)
   return dht.getTemperature();
 }

+// Read humidity
 float get_hum() {
-  // Read humidity
   return dht.getHumidity();
 }

+// check if wifi is connected and set WIFI_CONN and NO_IP to True
+void chk_wifi_conn(){
+  if(!WIFI_CONN){
+    // get ip address
+    get_ip();
+    delay(2000);
+    // check ip and NO_IP to True
+    check_ip(5000);
+  } else {
+    // do nothing
+  }
+
+  if(!NO_IP && !WIFI_CONN){
+    wifi_init();
+  } else {
+    NO_IP=true;
+    WIFI_CONN=true;
+  }
+}
+
+// Transmit Data over Wifi
 void TransmitData(){
   /*
   * Send JSON Data
   */
+  if(isopen){
+    root["open"]="True";
+  } else {
+    root["open"]="False";
+  }
+
+  if(!WIFI_CONN){
+    chk_wifi_conn();
+  } else {
+    // do nothing
+  }
+
   String jsonstring;
   root.printTo(jsonstring);

@@ -367,7 +420,7 @@
   wifi.print(F("AT+CIPSEND="));
   wifi.println(postRequest.length() );

-  delay(500);
+  delay(1000);

   if(wifi.find(">")){
     Serial.println(F("Sending..."));
@@ -379,8 +432,9 @@
         Serial.println(tmpResponse);
       }
       wifi.println(F("AT+CIPCLOSE"));
-
-    }
-  }
-}
-
+    }
+  } else {
+    wifi.println(F("AT+CIPCLOSE"));
+  }
+}
+


Update Firmware.ino

Update Firmware.ino

--- src/piggy_back_loggers/SD_Mag_Prototype/Firmware/Firmware.ino
+++ src/piggy_back_loggers/SD_Mag_Prototype/Firmware/Firmware.ino
@@ -201,8 +201,18 @@
   {
     State.readMag = false;
     readData(&mag, &SignalState);
-    if(peakDetected(&SignalState));
+    bool peak = peakDetected(&SignalState);
+    if(peak)
       State.pulseCount += 1;
+    /* Debugging Information: To be removed*/
+    SDPowerUp();
+    File waveFile = SD.open("waveform.csv", FILE_WRITE);
+    waveFile.print(peak, DEC);
+    waveFile.print(',');
+    waveFile.println(State.pulseCount);
+    waveFile.close();
+    SDPowerDown();
+    /* End Debugging */
   }
 }


Fixed the change SSID function.

Fixed the change SSID function.

--- BackEnd/BackEnd.ino
+++ BackEnd/BackEnd.ino
@@ -162,7 +162,9 @@
 // Configuration file
 #define CONFIG_FILE_MAX_SIZE WEB_SOCKET_BUFFER_SIZE
 #define CONFIG_FILE_FULL_PATH "/home/root/hardware.conf"
-#define HOSTAPD_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapd.conf"
+#define HOSTAPD_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapd_test.conf"
+//#define TEMP_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapd_tmp.conf"
+#define TEMP_CONFIG_FILE_FULL_PATH "/etc/hostapd/hostapdTest.conf"

 // Scripts
 #define START_ACCESS_POINT_SCRIPT_FULL_PATH "/home/root/startAP"
@@ -1332,52 +1334,52 @@

 int changeSsidName(char *_sSsidName)
 {
-//    char    sSsidName[LOCAL_BUFFER_SIZE];
-
   // Truncate Ssid if it too long
-  // SSID_MAX_LENGTH
+  snprintf(_sSsidName,SSID_MAX_LENGTH,"%s",_sSsidName);

 // We need a buffer to read in data
   char      Buffer[LOCAL_BUFFER_SIZE];
+  char      TempBuffer[LOCAL_BUFFER_SIZE];

   // Open the file for reading/write.
-  FILE     *Input = fopen(HOSTAPD_CONFIG_FILE_FULL_PATH, "r+"); // Read/write
+  FILE     *Input = fopen(HOSTAPD_CONFIG_FILE_FULL_PATH, "r"); // Read/write
+  FILE     *Output = fopen(TEMP_CONFIG_FILE_FULL_PATH, "w"); // Read/write

   // Our find and replace arguments
   char     *Find = "ssid=";
   char    sSsidLine[LOCAL_BUFFER_SIZE];

-//  Serial.println("Create SSID:    ");
   // Create file line
-  sprintf(sSsidLine, "ssid=%s", _sSsidName);
+  sprintf(sSsidLine,"ssid=%s\n", _sSsidName);

   if(NULL == Input)
   {
-      trace_info("%s(): /etc/hostapd/hostapd.conf File not found", __func__);
+      trace_info("%s(): %s file not found", __func__,HOSTAPD_CONFIG_FILE_FULL_PATH);
       return 1;
   }
-
-//  Serial.print("Find:    ");     Serial.println(Find);

   // For each line...
   while(NULL != fgets(Buffer, LOCAL_BUFFER_SIZE, Input))
   {
     char *Start = NULL;    // Where 'ssid=' was found in the line
     char *Line = Buffer; // Start at the beginning of the line, and after each match
-
- //   Serial.print("Line: "); Serial.println(Buffer);
-
-      // Find match
-    Start = strstr(Line, Find);
-    if( Start )
-    {
- //     Serial.print("Write: "); Serial.println(sSsidLine);
-      fwrite(sSsidLine, 1, strlen(sSsidLine), Input);
+
+    // Find match
+    if( strstr(Line, Find) )
+    {
+      fputs(sSsidLine, Output);
+    }
+    else
+    {
+      fputs(Line, Output);
     }
   }

   // Close our files
   fclose(Input);
+  fclose(Output);
+
+  rename(TEMP_CONFIG_FILE_FULL_PATH,HOSTAPD_CONFIG_FILE_FULL_PATH);

   return 0;
 }
@@ -1388,7 +1390,7 @@
 void loop()
 {

-  if (millis() - last_print > 2000) {
+  if (millis() - last_print > 3000) {

     ///////////////////////////////////////
     // Test code
@@ -1396,9 +1398,9 @@
 /*
     g_iCatNumber++;
     char sSsidName[100];
-    sprintf(sSsidName, "CAT%i", g_iCatNumber);
+    sprintf(sSsidName, "CA3333333333333333333333333333344444444444444444444444444444444444444444444T%i", g_iCatNumber);
     changeSsidName(sSsidName);
- */
+ */
     //////////////////////////////////////////

     last_print = millis();
@@ -1413,7 +1415,6 @@
   if (Serial.available() > 0) {
     // get incoming byte:
     g_iByte = Serial.read();
-    //Serial.println(g_iByte);

     switch (g_iByte)
     {


Issue #2: fixed time comparison; Corrected CurieBle.h inclusion; Clarified pin order.

--- DHTBLESensor.ino
+++ DHTBLESensor.ino
@@ -3,7 +3,7 @@
  * Based on Intel's CurieBLE Battery Monitor Example (LGPL)
  * and on Rob Tillaart's DHT library (Public Domain) http://playground.arduino.cc/Main/DHTLib
  *
- * Copyright (c) 2016 Bradford Needham
+ * Copyright (c) 2016, 2017 Bradford Needham
  * { @bneedhamia , https://www.needhamia.com, https://github.com/bneedhamia }
  *
  * Licensed under LGPL 2.1 (to match the CurieBLE example),
@@ -19,12 +19,13 @@
  * RHT03 parts and datasheets are available from Sparkfun: https://www.sparkfun.com/products/10167
  * Male/Female jumper wires for connecting the RHT02 (DHT22) are available from Sparkfun: https://www.sparkfun.com/products/9140
  */
-#include <CurieBle.h>
+#include <CurieBLE.h>
 #include <dht.h> // DHT22 library, modified for Arduino 101.  Source at https://github.com/bneedhamia/DHT

 /*
  * Pins:
- *   DHT22 pin 1 --> power input, connected to Arduino 3.3V
+ *   DHT22 pin 1 --> power input, connected to Arduino 5V
+ *     Pin 1 is the left pin as the open grid faces you and the pins point down.
  *   DHT22 pin 2 --> signal output to Arduino (connect to DHT22_DATA)
  *   DHT22 pin3 & 4 --> Arduino GND. Both 3 and 4 are grounded because
  *     some DHT22's expect pin 3 to be grounded, while others expect pin 4 to be grounded.
@@ -84,7 +85,7 @@
     //XXX change this into a state machine.
     while (central.connected()) {  //XXX Not a good idea because connecting hangs all other Arduino functions (like reset and download)
       long nowMs = millis();
-      if (nowMs - whenSensedMs >= TEMPERATURE_UPDATE_INTERVAL_MS) {
+      if ((long)(nowMs - whenSensedMs) >= TEMPERATURE_UPDATE_INTERVAL_MS) {
         readTemperatureAndHumidity();
         setBLETemperatureAndHumidity(dht22.temperature, dht22.humidity);
       }


Slowed down star field to be able to see bad guy bullets

--- arduboy-game/arduboy-game.ino
+++ arduboy-game/arduboy-game.ino
@@ -616,13 +616,16 @@
   starWidth[i] = random(1, 4);

   if (starWidth[i] >= 3) {
-    starSpeed[i] = random(75, 95) * 0.01f;
+//    starSpeed[i] = random(75, 95) * 0.01f;
+    starSpeed[i] = random(30, 40) * 0.01f;
   }
   else if (starWidth[i] >= 2) {
-    starSpeed[i] = random(35, 40) * 0.01f;
+//    starSpeed[i] = random(35, 40) * 0.01f;
+    starSpeed[i] = random(18, 25) * 0.01f;
   }
   else {
-    starSpeed[i] = random(15, 25) * 0.01f;
+//    starSpeed[i] = random(15, 25) * 0.01f;
+    starSpeed[i] = random(7, 12) * 0.01f;
   }
 }


removed debug code

removed debug code

--- arduino/pi_rover/pi_rover.ino
+++ arduino/pi_rover/pi_rover.ino
@@ -34,28 +34,26 @@
 }

 String getCommandFromInput(String input) {
-  return input;
+  String result = input;
+  int positionOfColon = input.indexOf(':');
+
+  if (positionOfColon)
+  {
+    result = input.substring(0, positionOfColon);
+  }
+
+  return result;
 }

 int getArgumentFromInput(String input) {
-
   int result = -1;
-
   int positionOfColon = input.indexOf(':');
-
-  Serial.print(String("Position of colon: ")+positionOfColon+"\n");

   if (positionOfColon)
   {
     int length = input.length() - positionOfColon;
-
-    Serial.print(String("Length: ")+length+"\n");
-
-    String argumentToBeParsedToInt = input.substring(positionOfColon);
-
-    Serial.print(String("argumentToBeParsedToInt: ")+argumentToBeParsedToInt+"\n");
-
-    //result = atoi(argumentToBeParsedToInt);
+    String argument = input.substring(positionOfColon + 1);
+    result = argument.toInt();
   }

   return result;
@@ -69,17 +67,17 @@
   int argument = getArgumentFromInput(input);

   if(command == "check battery status") {
-    result = checkBatteryStatus();
+    result = checkBatteryStatus(argument);
   } else if(command == "forward") {
-    result = forward();
+    result = forward(argument);
   } else if(command == "backward") {
-    result = backward();
+    result = backward(argument);
   } else if(command == "left") {
-    result = left();
+    result = left(argument);
   } else if(command == "right") {
-    result = right();
+    result = right(argument);
   } else if(command == "stop") {
-    result = halt();
+    result = halt(argument);
   } else {
     result = "unknown command: " + command + ", arg: " + argument;
   }
@@ -87,7 +85,7 @@
   return result;
 }

-String forward()
+String forward(int speedInP87ercentage)
 {
   turnMotorsOn();

@@ -99,7 +97,7 @@
   return "ok";
 }

-String backward()
+String backward(int argument)
 {
   turnMotorsOn();

@@ -111,7 +109,7 @@
   return "ok";
 }

-String halt()
+String halt(int argument)
 {
   turnMotorsOff();

@@ -120,7 +118,7 @@

-String left()
+String left(int argument)
 {
   turnMotorsOn();

@@ -136,7 +134,7 @@
   return "ok";
 }

-String right()
+String right(int argument)
 {
   turnMotorsOn();

@@ -152,7 +150,7 @@
   return "ok";
 }

-String checkBatteryStatus()
+String checkBatteryStatus(int argument)
 {
   return "battery status is " + String(random(0, 1));
 }