Fix indent

Fix indent

--- examples/Boards_USB_Serial/ATtiny85/ATtiny85.ino
+++ examples/Boards_USB_Serial/ATtiny85/ATtiny85.ino
@@ -26,8 +26,8 @@
  *
  **************************************************************/
 #include <SoftwareSerial.h>
-SoftwareSerial DebugSerial(1,2); // RX, TX
-SoftwareSerial SwSerial(3,4);
+SoftwareSerial DebugSerial(1, 2); // RX, TX
+SoftwareSerial SwSerial(3, 4);

 //#define BLYNK_DEBUG
 #define BLYNK_PRINT DebugSerial    // Comment this out to disable prints and save space
@@ -44,7 +44,7 @@
 {
   // Debug console
   DebugSerial.begin(9600);
-
+
   // Blynk will work through SoftwareSerial
   SwSerial.begin(9600);
   Blynk.begin(auth, SwSerial);


Changed pinout to nordic board

Changed pinout to nordic board

--- demos/ble_heart_rate_template/ble_heart_rate_template.ino
+++ demos/ble_heart_rate_template/ble_heart_rate_template.ino
@@ -108,16 +108,16 @@
   Tell the ACI library, the MCU to nRF8001 pin connections.
   The Active pin is optional and can be marked UNUSED
   */
-  aci_state.aci_pins.board_name = REDBEARLAB_SHIELD_V1_1; //See board.h for details
-  aci_state.aci_pins.reqn_pin   = 9;
-  aci_state.aci_pins.rdyn_pin   = 8;
+  aci_state.aci_pins.board_name = BOARD_DEFAULT; //See board.h for details REDBEARLAB_SHIELD_V1_1 or BOARD_DEFAULT
+  aci_state.aci_pins.reqn_pin   = SS; //SS for Nordic board, 9 for REDBEARLABS
+  aci_state.aci_pins.rdyn_pin   = 3; //3 for Nordic board, 8 for REDBEARLABS
   aci_state.aci_pins.mosi_pin   = MOSI;
   aci_state.aci_pins.miso_pin   = MISO;
   aci_state.aci_pins.sck_pin    = SCK;

   aci_state.aci_pins.spi_clock_divider     = SPI_CLOCK_DIV8;

-  aci_state.aci_pins.reset_pin             = UNUSED;
+  aci_state.aci_pins.reset_pin             = 4; //4 for Nordic board, UNUSED for REDBEARLABS
   aci_state.aci_pins.active_pin            = UNUSED;
   aci_state.aci_pins.optional_chip_sel_pin = UNUSED;


Fixed Typo

Fixed Typo

Removed forgotten comment section

--- nRF51822-BLEMIDI/nRF51822-BLEMIDI.ino
+++ nRF51822-BLEMIDI/nRF51822-BLEMIDI.ino
@@ -81,7 +81,6 @@
 GattCharacteristic  txCharacteristic (uart_tx_uuid, txPayload, 1, 20,
                                      GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);

-*/
 GattCharacteristic *uartChars[] = {&txCharacteristic};
 GattService         uartService(uart_base_uuid, uartChars, sizeof(uartChars) / sizeof(GattCharacteristic *));


Update ant_switch_arduino_netshield.ino

Update ant_switch_arduino_netshield.ino

--- docs/arduino-nano-netshield/ant_switch_arduino_netshield.ino
+++ docs/arduino-nano-netshield/ant_switch_arduino_netshield.ino
@@ -5,12 +5,12 @@
  *
  * 8 selecteable antennas in digital outputs d2,d3,d4,d5,d6,d7,d8,d9
  *
- * curl http://172.16.50.19/?cmd=1 set antenna 1 (only)
- * curl http://172.16.50.19/?cmd=+1 add antenna 1
- * curl http://172.16.50.19/?cmd=-1 remove antenna 1
- * curl http://172.16.50.19/?cmd=t1 toggle antenna 1
- * curl http://172.16.50.19/?cmd=g ground all altennas
- * curl http://172.16.50.19/?cmd=s show selected antennas
+ * curl http://192.168.0.19/?cmd=1 set antenna 1 (only)
+ * curl http://192.168.0.19/?cmd=+1 add antenna 1
+ * curl http://192.168.0.19/?cmd=-1 remove antenna 1
+ * curl http://192.168.0.19/?cmd=t1 toggle antenna 1
+ * curl http://192.168.0.19/?cmd=g ground all altennas
+ * curl http://192.168.0.19/?cmd=s show selected antennas
  *
  * This is part of KiwiSDR antenna switch extension
  * https://github.com/OH1KK/KiwiSDR-antenna-switch-extension
@@ -35,11 +35,11 @@
   // the dns server ip
   IPAddress dnServer(8, 8, 8, 8);
   // the router's gateway address:
-  IPAddress gateway(172, 16, 50, 1);
+  IPAddress gateway(192, 168, 0, 1);
   // the subnet:
   IPAddress subnet(255, 255, 255, 0);
   //the IP address is dependent on your network
-  IPAddress ip(172, 16, 50, 19);
+  IPAddress ip(192, 168, 0, 19);

   Ethernet.begin(mac, ip, dnServer, gateway, subnet);


change pwm frequency .. maybe?

change pwm frequency .. maybe?

--- Controller/Tiny85-Standalone-22H/Tiny85-Standalone-22H.ino
+++ Controller/Tiny85-Standalone-22H/Tiny85-Standalone-22H.ino
@@ -8,7 +8,6 @@
  *                   +-------+
  */

-
 const byte MOTOR_PWM = 1;
 const byte MOTOR_START = 2;
 const byte POT = A2;
@@ -20,16 +19,28 @@

 const byte SAMPLE_COUNT = 10;

+// pwm info from http://matt16060936.blogspot.co.uk/2012/04/attiny-pwm.html
+
 void setup()
 {
-  pinMode(MOTOR_PWM, OUTPUT);
   pinMode(MOTOR_START, OUTPUT);
   pinMode(POT, INPUT);
-  pinMode(LED_SPEED, OUTPUT);

-  digitalWrite(LED_SPEED, LOW);
-  digitalWrite(MOTOR_PWM, LOW);
+  // set PB0, PB1 to output mode
+  DDRB = 1<<DDB1 | 1<<DDB0;
+  // clear OCOA and OCOB on compare-match, set at bottom
+  // enable fast-pwm
+  TCCR0A = 2<<COM0A0 | 2<<COM0B0 | 3<<WGM00;
+  // enable fast-pwm
+  // do not use a prescaler
+  TCCR0B = 0<<WGM02 | 1<<CS00;
+
   digitalWrite(MOTOR_START, LOW);
+
+  // PB1 (Motor)
+  OCR0B = 0;
+  // PB0 (LED)
+  OCR0A = 0;
 }

 void loop()
@@ -56,7 +67,9 @@
   else
   {
     digitalWrite(MOTOR_START, HIGH);
-    analogWrite(MOTOR_PWM, out);
+    // PB1 (Motor)
+    OCR0B = out;
   }
-  analogWrite(LED_SPEED, out - MIN_PWM);
+  // PB0 (LED)
+  OCR0A = out - MIN_PWM;
 }


Moved screen saver deactivation to getclicktype

--- src/cyclop_plus/cyclop_plus.ino
+++ src/cyclop_plus/cyclop_plus.ino
@@ -50,6 +50,7 @@
 //******************************************************************************
 //* File scope function declarations

+void     activateScreenSaver( void );
 uint16_t autoScan( uint16_t frequency );
 uint16_t averageAnalogRead( uint8_t pin );
 void     batteryMeter(void);
@@ -58,7 +59,6 @@
 void     drawAutoScanScreen(void);
 void     drawBattery(uint8_t xPos, uint8_t yPos, uint8_t value );
 void     drawChannelScreen( uint8_t channel, uint16_t rssi);
-void     drawEmptyScreen( void );
 void     drawOptionsScreen(uint8_t option );
 void     drawScannerScreen( void );
 void     drawStartScreen(void);
@@ -129,7 +129,7 @@
 uint16_t alarmOnPeriod = 0;
 uint16_t alarmOffPeriod = 0;
 uint8_t options[MAX_OPTIONS];
-boolean saveScreenActive = 0;
+uint8_t saveScreenActive = 0;

 //******************************************************************************
 //* function: setup
@@ -214,10 +214,8 @@
       break;

     case SINGLE_CLICK: // up the frequency
-      if (!( options[SAVE_SCREEN_OPTION] && saveScreenActive )) { // Single click to wake up
-        currentChannel = nextChannel( currentChannel );
-        setRTC6715Frequency(getFrequency(currentChannel));
-      }
+      currentChannel = nextChannel( currentChannel );
+      setRTC6715Frequency(getFrequency(currentChannel));
       drawChannelScreen(currentChannel, 0);
       break;

@@ -234,7 +232,7 @@
   // Check if the display needs updating
   if ( millis() > displayUpdateTimer ) {
     if ( options[SAVE_SCREEN_OPTION] && (saveScreenTimer < millis()))
-      drawEmptyScreen();
+      activateScreenSaver();
     else
     {
       currentRssi = averageAnalogRead(RSSI_PIN);
@@ -325,6 +323,13 @@
   if (digitalRead(buttonPin) == !BUTTON_PRESSED)
     return ( NO_CLICK );

+  // If the screen saver is active the key press is just a wakeup call
+  if (saveScreenActive) {
+    saveScreenActive = 0;
+    while (digitalRead(buttonPin) == BUTTON_PRESSED) ;
+    return ( NO_CLICK );
+  }
+
   while (digitalRead(buttonPin) == BUTTON_PRESSED) {
     timer++;
     delay(5);
@@ -343,7 +348,7 @@
   }
   if (timer >= 40)                  // 40 * 5 ms = 0.2s
     return click_type;
-
+
   if (digitalRead(buttonPin) == BUTTON_PRESSED ) {
     click_type = DOUBLE_CLICK;
     while (digitalRead(buttonPin) == BUTTON_PRESSED) ;
@@ -839,8 +844,6 @@
 void drawStartScreen( void ) {
   uint8_t i;

-  saveScreenActive = 0;
-
   display.clearDisplay();
   display.drawLine(0, 0, 127, 0, WHITE);
   display.setTextColor(WHITE);
@@ -873,8 +876,6 @@
 void drawChannelScreen( uint8_t channel, uint16_t rssi) {
   char buffer[22];
   uint8_t i;
-
-  saveScreenActive = 0;

   display.clearDisplay();
   display.setTextColor(WHITE);
@@ -911,7 +912,6 @@
 //* function: drawAutoScanScreen
 //******************************************************************************
 void drawAutoScanScreen( void ) {
-  saveScreenActive = 0;

   display.clearDisplay();
   display.setTextColor(WHITE);
@@ -933,7 +933,6 @@
 //* function: drawScannerScreen
 //******************************************************************************
 void drawScannerScreen( void ) {
-  saveScreenActive = 0;

   display.clearDisplay();
   display.drawLine(0, 55, 127, 55, WHITE);
@@ -955,8 +954,6 @@
   static uint8_t last_position = 14;
   static uint8_t last_value = 0;

-  saveScreenActive = 0;
-
   // The scan graph only uses the 100 positions in the middle of the screen
   position = position + 14;

@@ -980,7 +977,6 @@
 //*         : value = 0 to 100
 //******************************************************************************
 void drawBattery(uint8_t xPos, uint8_t yPos, uint8_t value ) {
-  saveScreenActive = 0;

   display.drawRect(3 + xPos,  0 + yPos, 4, 2, WHITE);
   display.drawRect(0 + xPos, 2 + yPos, 10, 20, WHITE);
@@ -1003,8 +999,6 @@
 void drawOptionsScreen(uint8_t option ) {
   uint8_t i, j;

-  saveScreenActive = 0;
-
   display.clearDisplay();
   display.setCursor(0, 0);
   display.setTextSize(1);
@@ -1050,9 +1044,9 @@
 }

 //******************************************************************************
-//* function: drawEmptyScreen
-//******************************************************************************
-void drawEmptyScreen( void)
+//* function: activateScreenSaver
+//******************************************************************************
+void activateScreenSaver( void)
 {
   display.clearDisplay();
   display.display();


minor adjustments to enable_servos define

--- RobotAnimations/RobotAnimations.ino
+++ RobotAnimations/RobotAnimations.ino
@@ -52,8 +52,8 @@
 //const vector<short> kServoCenter = { 0, 320, 320, 345, 290, 330, 320, 345, 290 };
 const std::vector<ServoConfig> kServoSpecs = {
   { { 0, 0 }, 0, false},
-  { kServoKy66, 0, false}, { kServoKy66, 90, true}, { kServoKy66, 90, false}, { kServoA0090, 0, false},
-  { kServoKy66, 0, false}, { kServoKy66, 90, true}, { kServoKy66, 90, false}, { kServoA0090, 0, false}
+  { kServoKy66, 90, true}, { kServoKy66, 90, true}, { kServoKy66, 90, true}, { kServoA0090, 0, false},
+  { kServoKy66, 90, false}, { kServoKy66, 90, false}, { kServoKy66, 90, false}, { kServoA0090, 0, false}
 };
 std::vector<int> _lastServoValues(kServoSpecs.size());
 LatchButton _leftButton(CPLAY_LEFTBUTTON, InputPinMode::PullDown);
@@ -96,7 +96,7 @@
   Serial.println("Starting PWM");
   Serial.println("(if this doesn't continue, maybe the servo board is unplugged?)");

-#if ENABLE_SERVOS
+#ifdef ENABLE_SERVOS
   _servoMux.begin();
   _servoMux.setPWMFreq(60);
   delay(10);
@@ -170,11 +170,6 @@
     serialPrintfln("output enable -> %s", _outputEnable ? "true" : "false");
   }

-  if (_rightButton.getAndClearState())
-  {
-    startAnimation("Wave");
-  }
-
   if (millis() - _lastFrameMillis > kMilliPerFrame)
   {
     if (!advanceFrame(_actionIndex == _idleAction))
@@ -187,7 +182,7 @@
   if (_actionIndex != -1)
   {
     auto& frame = kActions[_actionIndex].frames[_frameIndex];
-
+
     for (int servoIndex = 0; servoIndex < kServoSpecs.size(); servoIndex++)
     {
       auto& servoConfig = kServoSpecs[servoIndex];
@@ -199,9 +194,9 @@
       if (_lastServoValues[servoIndex] != pulseLen)
       {
         _lastServoValues[servoIndex] = pulseLen;
-  #ifdef ENABLE_SERVOS
+#ifdef ENABLE_SERVOS
         _servoMux.setPWM(servoIndex, 0, pulseLen);
-  #endif
+#endif
       }
     }
   }


improved firmware

improved firmware

--- Arduino/Arduino.ino
+++ Arduino/Arduino.ino
@@ -3,6 +3,14 @@
  * Website: www.christianbenjaminries.de
  * GitHub: https://github.com/cbries
  * License: MIT, see https://github.com/cbries
+ *
+ * 2015-04-06 Christian Benjamin Ries
+ *   - added command for switching between default modes
+ *      'mA'  run in grid mode which allows setting of individual led values
+ *      'mB'  randmom leds
+ *      'mC'  color wave
+ *      'mD'  rainbow
+ *      'mE'  show Super Mario's Goomba :)
  *
  * 2015-02-27 Christian Benjamin Ries
  *   - correct rgb mapping of serial received data
@@ -225,48 +233,6 @@
   setup_timer1_ovf();
 }

-void runaround()
-{
-  static byte n = 250;
-  static byte r = 0;
-  static byte g = MAX_BRIGHTNESS;
-  static byte b = 0;
-
-  r = random(MAX_BRIGHTNESS);
-  g = random(MAX_BRIGHTNESS);
-  b = random(MAX_BRIGHTNESS);
-
-  for(byte y=0; y < HEIGHT; ++y)
-  {
-    for(byte x=0; x < WIDTH; ++x)
-    {
-      memset((void*)brightness, 0, sizeof(brightness));
-      set_led_rgb(x, y, r, g, b);
-      delay(n);
-    }
-
-    ++y;
-
-    for(int x=WIDTH-1; x != -1; --x)
-    {
-      memset((void*)brightness, 0, sizeof(brightness));
-      set_led_rgb(x, y, r, g, b);
-      delay(n);
-    }
-  }
-
-  for(byte y=HEIGHT-2; y != 0; --y)
-  {
-    memset((void*)brightness, 0, sizeof(brightness));
-    set_led_rgb(0, y, r, g, b);
-    delay(n);
-  }
-
-  r = random(MAX_BRIGHTNESS);
-  g = random(MAX_BRIGHTNESS);
-  b = random(MAX_BRIGHTNESS);
-}
-
 void random_leds(void) {
   set_led_hue(
       (byte)(random(WIDTH))
@@ -314,15 +280,19 @@
   ptrBrightnessUSING = ptrBrightness;
 }

+volatile byte RUNMODE = 'C';
+
 void loop(void)
 {
-  //for(unsigned int i=0; i < 1000000; ++i) { random_leds(); /*copyBuffer();*/ delay(5); }
-  //for(;;) { color_wave(18); copyBuffer(); delay(75); }
-  //for(;;) { rainbow(); delay(100); }
-  //runaround();
-
   checkSerial();
-  runGrid();
+  switch(RUNMODE)
+  {
+    case 'A': runGrid(); break;
+    case 'B': for(unsigned int i=0; i < 100; ++i) { random_leds(); copyBuffer(); delayMicroseconds(10); } break;
+    case 'C': color_wave(18); copyBuffer(); delayMicroseconds(25); break;
+    case 'D': rainbow(); delayMicroseconds(25); break;
+    case 'E': ShowGoomba(); delayMicroseconds(25); break;
+  }
 }

 inline void set_led_red(byte x, byte y, byte red)     { *(ptrBrightness + RED(x, y)) = red; }
@@ -396,6 +366,12 @@
       Serial.println(" OK ");
     }

+    if(sbuf[0] == 'm' && index == 3)
+    {
+      RUNMODE = sbuf[1];
+      Serial.println(" OK ");
+    }
+
     if(sbuf[0] == 'b' && index == 5)
     {
       String s("");
@@ -449,9 +425,9 @@
     }
   }
 }
+
 void runGrid()
 {
-
   for(uint8_t x = 0; x < WIDTH; ++x) {
     for(uint8_t y = 0; y < HEIGHT; ++y) {

@@ -466,18 +442,20 @@
     }
   }
   delayMicroseconds(100);
-/*
-        // Shows a Goomba, see https://raw.githubusercontent.com/cbries/rgbwall/master/Photos,%20Images,%20Videos/Goomba01.jpg
-	set_led_rgb(0, 0, 13, 9, 7);	set_led_rgb(1, 0, 13, 5, 0);	set_led_rgb(2, 0, 8, 3, 0);	set_led_rgb(3, 0, 5, 2, 1);	set_led_rgb(4, 0, 5, 4, 4);	set_led_rgb(5, 0, 7, 3, 0);	set_led_rgb(6, 0, 10, 4, 0);	set_led_rgb(7, 0, 13, 5, 0);	set_led_rgb(8, 0, 13, 5, 0);	set_led_rgb(9, 0, 13, 5, 0);	set_led_rgb(10, 0, 13, 5, 0);	set_led_rgb(11, 0, 13, 5, 0);	set_led_rgb(12, 0, 11, 4, 0);	set_led_rgb(13, 0, 8, 3, 0);	set_led_rgb(14, 0, 5, 4, 4);	set_led_rgb(15, 0, 5, 3, 1);	set_led_rgb(16, 0, 7, 2, 0);	set_led_rgb(17, 0, 13, 5, 0);	set_led_rgb(18, 0, 13, 8, 5);	set_led_rgb(19, 0, 14, 11, 10);
-	set_led_rgb(0, 1, 13, 5, 0);	set_led_rgb(1, 1, 13, 5, 0);	set_led_rgb(2, 1, 13, 5, 0);	set_led_rgb(3, 1, 13, 6, 2);	set_led_rgb(4, 1, 13, 12, 10);	set_led_rgb(5, 1, 2, 2, 2);	set_led_rgb(6, 1, 5, 2, 0);	set_led_rgb(7, 1, 13, 5, 0);	set_led_rgb(8, 1, 13, 5, 0);	set_led_rgb(9, 1, 13, 5, 0);	set_led_rgb(10, 1, 13, 5, 0);	set_led_rgb(11, 1, 13, 5, 0);	set_led_rgb(12, 1, 7, 3, 0);	set_led_rgb(13, 1, 0, 0, 0);	set_led_rgb(14, 1, 13, 12, 9);	set_led_rgb(15, 1, 13, 8, 4);	set_led_rgb(16, 1, 13, 5, 0);	set_led_rgb(17, 1, 13, 5, 0);	set_led_rgb(18, 1, 13, 5, 0);	set_led_rgb(19, 1, 13, 6, 1);
-	set_led_rgb(0, 2, 13, 5, 0);	set_led_rgb(1, 2, 13, 5, 0);	set_led_rgb(2, 2, 13, 5, 0);	set_led_rgb(3, 2, 13, 6, 2);	set_led_rgb(4, 2, 13, 12, 10);	set_led_rgb(5, 2, 2, 2, 2);	set_led_rgb(6, 2, 0, 0, 0);	set_led_rgb(7, 2, 0, 0, 0);	set_led_rgb(8, 2, 0, 0, 0);	set_led_rgb(9, 2, 0, 0, 0);	set_led_rgb(10, 2, 0, 0, 0);	set_led_rgb(11, 2, 0, 0, 0);	set_led_rgb(12, 2, 0, 0, 0);	set_led_rgb(13, 2, 0, 0, 0);	set_led_rgb(14, 2, 13, 12, 9);	set_led_rgb(15, 2, 13, 8, 4);	set_led_rgb(16, 2, 13, 5, 0);	set_led_rgb(17, 2, 13, 5, 0);	set_led_rgb(18, 2, 13, 5, 0);	set_led_rgb(19, 2, 13, 6, 2);
-	set_led_rgb(0, 3, 13, 5, 0);	set_led_rgb(1, 3, 13, 5, 0);	set_led_rgb(2, 3, 13, 5, 0);	set_led_rgb(3, 3, 13, 6, 2);	set_led_rgb(4, 3, 13, 12, 10);	set_led_rgb(5, 3, 2, 2, 2);	set_led_rgb(6, 3, 2, 1, 1);	set_led_rgb(7, 3, 5, 4, 4);	set_led_rgb(8, 3, 7, 3, 0);	set_led_rgb(9, 3, 8, 3, 0);	set_led_rgb(10, 3, 8, 3, 0);	set_led_rgb(11, 3, 5, 4, 4);	set_led_rgb(12, 3, 3, 2, 2);	set_led_rgb(13, 3, 0, 0, 0);	set_led_rgb(14, 3, 13, 12, 9);	set_led_rgb(15, 3, 13, 8, 4);	set_led_rgb(16, 3, 13, 5, 0);	set_led_rgb(17, 3, 13, 5, 0);	set_led_rgb(18, 3, 13, 5, 0);	set_led_rgb(19, 3, 13, 5, 0);
-	set_led_rgb(0, 4, 13, 5, 0);	set_led_rgb(1, 4, 13, 5, 0);	set_led_rgb(2, 4, 13, 5, 0);	set_led_rgb(3, 4, 13, 6, 2);	set_led_rgb(4, 4, 13, 12, 10);	set_led_rgb(5, 4, 2, 2, 2);	set_led_rgb(6, 4, 5, 4, 4);	set_led_rgb(7, 4, 13, 12, 10);	set_led_rgb(8, 4, 13, 5, 0);	set_led_rgb(9, 4, 13, 5, 0);	set_led_rgb(10, 4, 13, 5, 0);	set_led_rgb(11, 4, 13, 12, 10);	set_led_rgb(12, 4, 8, 7, 6);	set_led_rgb(13, 4, 0, 0, 0);	set_led_rgb(14, 4, 13, 12, 9);	set_led_rgb(15, 4, 13, 8, 4);	set_led_rgb(16, 4, 13, 5, 0);	set_led_rgb(17, 4, 13, 5, 0);	set_led_rgb(18, 4, 13, 5, 0);	set_led_rgb(19, 4, 13, 5, 0);
-	set_led_rgb(0, 5, 13, 5, 0);	set_led_rgb(1, 5, 13, 5, 0);	set_led_rgb(2, 5, 13, 5, 0);	set_led_rgb(3, 5, 13, 6, 2);	set_led_rgb(4, 5, 13, 12, 10);	set_led_rgb(5, 5, 13, 12, 10);	set_led_rgb(6, 5, 13, 12, 10);	set_led_rgb(7, 5, 13, 11, 10);	set_led_rgb(8, 5, 13, 5, 0);	set_led_rgb(9, 5, 13, 5, 0);	set_led_rgb(10, 5, 13, 5, 0);	set_led_rgb(11, 5, 13, 12, 10);	set_led_rgb(12, 5, 13, 12, 10);	set_led_rgb(13, 5, 13, 12, 10);	set_led_rgb(14, 5, 13, 12, 9);	set_led_rgb(15, 5, 13, 8, 4);	set_led_rgb(16, 5, 13, 5, 0);	set_led_rgb(17, 5, 13, 5, 0);	set_led_rgb(18, 5, 13, 5, 0);	set_led_rgb(19, 5, 13, 5, 0);
-	set_led_rgb(0, 6, 13, 5, 0);	set_led_rgb(1, 6, 13, 5, 0);	set_led_rgb(2, 6, 13, 5, 0);	set_led_rgb(3, 6, 13, 5, 1);	set_led_rgb(4, 6, 13, 8, 4);	set_led_rgb(5, 6, 13, 8, 4);	set_led_rgb(6, 6, 13, 8, 4);	set_led_rgb(7, 6, 13, 8, 4);	set_led_rgb(8, 6, 13, 5, 0);	set_led_rgb(9, 6, 13, 5, 0);	set_led_rgb(10, 6, 13, 5, 0);	set_led_rgb(11, 6, 13, 8, 4);	set_led_rgb(12, 6, 13, 8, 4);	set_led_rgb(13, 6, 13, 8, 4);	set_led_rgb(14, 6, 13, 8, 4);	set_led_rgb(15, 6, 13, 6, 2);	set_led_rgb(16, 6, 13, 5, 0);	set_led_rgb(17, 6, 13, 5, 0);	set_led_rgb(18, 6, 13, 5, 0);	set_led_rgb(19, 6, 13, 5, 0);
-	set_led_rgb(0, 7, 13, 5, 0);	set_led_rgb(1, 7, 13, 5, 0);	set_led_rgb(2, 7, 13, 5, 0);	set_led_rgb(3, 7, 13, 5, 0);	set_led_rgb(4, 7, 13, 5, 0);	set_led_rgb(5, 7, 13, 5, 0);	set_led_rgb(6, 7, 13, 5, 0);	set_led_rgb(7, 7, 13, 5, 0);	set_led_rgb(8, 7, 13, 5, 0);	set_led_rgb(9, 7, 13, 5, 0);	set_led_rgb(10, 7, 13, 5, 0);	set_led_rgb(11, 7, 13, 5, 0);	set_led_rgb(12, 7, 13, 5, 0);	set_led_rgb(13, 7, 13, 5, 0);	set_led_rgb(14, 7, 13, 5, 0);	set_led_rgb(15, 7, 13, 5, 0);	set_led_rgb(16, 7, 13, 5, 0);	set_led_rgb(17, 7, 13, 5, 0);	set_led_rgb(18, 7, 13, 5, 0);	set_led_rgb(19, 7, 13, 5, 0);
-	set_led_rgb(0, 8, 13, 5, 0);	set_led_rgb(1, 8, 13, 5, 0);	set_led_rgb(2, 8, 13, 5, 0);	set_led_rgb(3, 8, 13, 5, 0);	set_led_rgb(4, 8, 13, 5, 0);	set_led_rgb(5, 8, 13, 9, 6);	set_led_rgb(6, 8, 13, 12, 10);	set_led_rgb(7, 8, 13, 12, 10);	set_led_rgb(8, 8, 13, 12, 10);	set_led_rgb(9, 8, 13, 12, 10);	set_led_rgb(10, 8, 13, 12, 10);	set_led_rgb(11, 8, 13, 12, 10);	set_led_rgb(12, 8, 13, 12, 10);	set_led_rgb(13, 8, 13, 10, 8);	set_led_rgb(14, 8, 13, 5, 0);	set_led_rgb(15, 8, 13, 5, 0);	set_led_rgb(16, 8, 13, 5, 0);	set_led_rgb(17, 8, 13, 5, 0);	set_led_rgb(18, 8, 13, 5, 0);	set_led_rgb(19, 8, 13, 6, 2);
-	set_led_rgb(0, 9, 14, 11, 8);	set_led_rgb(1, 9, 14, 11, 9);	set_led_rgb(2, 9, 14, 11, 9);	set_led_rgb(3, 9, 13, 10, 7);	set_led_rgb(4, 9, 13, 9, 6);	set_led_rgb(5, 9, 13, 11, 8);	set_led_rgb(6, 9, 13, 12, 10);	set_led_rgb(7, 9, 13, 12, 10);	set_led_rgb(8, 9, 13, 12, 10);	set_led_rgb(9, 9, 13, 12, 10);	set_led_rgb(10, 9, 13, 12, 10);	set_led_rgb(11, 9, 13, 12, 10);	set_led_rgb(12, 9, 13, 12, 10);	set_led_rgb(13, 9, 13, 11, 9);	set_led_rgb(14, 9, 13, 9, 6);	set_led_rgb(15, 9, 14, 10, 7);	set_led_rgb(16, 9, 14, 11, 9);	set_led_rgb(17, 9, 14, 11, 9);	set_led_rgb(18, 9, 14, 11, 9);	set_led_rgb(19, 9, 14, 11, 9);
-	delay(1000);
-*/
-}
+}
+
+void ShowGoomba()
+{
+  // Shows a Goomba, see https://raw.githubusercontent.com/cbries/rgbwall/master/Photos,%20Images,%20Videos/Goomba01.jpg
+  set_led_rgb(0, 0, 13, 9, 7);	set_led_rgb(1, 0, 13, 5, 0);	set_led_rgb(2, 0, 8, 3, 0);	set_led_rgb(3, 0, 5, 2, 1);	set_led_rgb(4, 0, 5, 4, 4);	set_led_rgb(5, 0, 7, 3, 0);	set_led_rgb(6, 0, 10, 4, 0);	set_led_rgb(7, 0, 13, 5, 0);	set_led_rgb(8, 0, 13, 5, 0);	set_led_rgb(9, 0, 13, 5, 0);	set_led_rgb(10, 0, 13, 5, 0);	set_led_rgb(11, 0, 13, 5, 0);	set_led_rgb(12, 0, 11, 4, 0);	set_led_rgb(13, 0, 8, 3, 0);	set_led_rgb(14, 0, 5, 4, 4);	set_led_rgb(15, 0, 5, 3, 1);	set_led_rgb(16, 0, 7, 2, 0);	set_led_rgb(17, 0, 13, 5, 0);	set_led_rgb(18, 0, 13, 8, 5);	set_led_rgb(19, 0, 14, 11, 10);
+  set_led_rgb(0, 1, 13, 5, 0);	set_led_rgb(1, 1, 13, 5, 0);	set_led_rgb(2, 1, 13, 5, 0);	set_led_rgb(3, 1, 13, 6, 2);	set_led_rgb(4, 1, 13, 12, 10);	set_led_rgb(5, 1, 2, 2, 2);	set_led_rgb(6, 1, 5, 2, 0);	set_led_rgb(7, 1, 13, 5, 0);	set_led_rgb(8, 1, 13, 5, 0);	set_led_rgb(9, 1, 13, 5, 0);	set_led_rgb(10, 1, 13, 5, 0);	set_led_rgb(11, 1, 13, 5, 0);	set_led_rgb(12, 1, 7, 3, 0);	set_led_rgb(13, 1, 0, 0, 0);	set_led_rgb(14, 1, 13, 12, 9);	set_led_rgb(15, 1, 13, 8, 4);	set_led_rgb(16, 1, 13, 5, 0);	set_led_rgb(17, 1, 13, 5, 0);	set_led_rgb(18, 1, 13, 5, 0);	set_led_rgb(19, 1, 13, 6, 1);
+  set_led_rgb(0, 2, 13, 5, 0);	set_led_rgb(1, 2, 13, 5, 0);	set_led_rgb(2, 2, 13, 5, 0);	set_led_rgb(3, 2, 13, 6, 2);	set_led_rgb(4, 2, 13, 12, 10);	set_led_rgb(5, 2, 2, 2, 2);	set_led_rgb(6, 2, 0, 0, 0);	set_led_rgb(7, 2, 0, 0, 0);	set_led_rgb(8, 2, 0, 0, 0);	set_led_rgb(9, 2, 0, 0, 0);	set_led_rgb(10, 2, 0, 0, 0);	set_led_rgb(11, 2, 0, 0, 0);	set_led_rgb(12, 2, 0, 0, 0);	set_led_rgb(13, 2, 0, 0, 0);	set_led_rgb(14, 2, 13, 12, 9);	set_led_rgb(15, 2, 13, 8, 4);	set_led_rgb(16, 2, 13, 5, 0);	set_led_rgb(17, 2, 13, 5, 0);	set_led_rgb(18, 2, 13, 5, 0);	set_led_rgb(19, 2, 13, 6, 2);
+  set_led_rgb(0, 3, 13, 5, 0);	set_led_rgb(1, 3, 13, 5, 0);	set_led_rgb(2, 3, 13, 5, 0);	set_led_rgb(3, 3, 13, 6, 2);	set_led_rgb(4, 3, 13, 12, 10);	set_led_rgb(5, 3, 2, 2, 2);	set_led_rgb(6, 3, 2, 1, 1);	set_led_rgb(7, 3, 5, 4, 4);	set_led_rgb(8, 3, 7, 3, 0);	set_led_rgb(9, 3, 8, 3, 0);	set_led_rgb(10, 3, 8, 3, 0);	set_led_rgb(11, 3, 5, 4, 4);	set_led_rgb(12, 3, 3, 2, 2);	set_led_rgb(13, 3, 0, 0, 0);	set_led_rgb(14, 3, 13, 12, 9);	set_led_rgb(15, 3, 13, 8, 4);	set_led_rgb(16, 3, 13, 5, 0);	set_led_rgb(17, 3, 13, 5, 0);	set_led_rgb(18, 3, 13, 5, 0);	set_led_rgb(19, 3, 13, 5, 0);
+  set_led_rgb(0, 4, 13, 5, 0);	set_led_rgb(1, 4, 13, 5, 0);	set_led_rgb(2, 4, 13, 5, 0);	set_led_rgb(3, 4, 13, 6, 2);	set_led_rgb(4, 4, 13, 12, 10);	set_led_rgb(5, 4, 2, 2, 2);	set_led_rgb(6, 4, 5, 4, 4);	set_led_rgb(7, 4, 13, 12, 10);	set_led_rgb(8, 4, 13, 5, 0);	set_led_rgb(9, 4, 13, 5, 0);	set_led_rgb(10, 4, 13, 5, 0);	set_led_rgb(11, 4, 13, 12, 10);	set_led_rgb(12, 4, 8, 7, 6);	set_led_rgb(13, 4, 0, 0, 0);	set_led_rgb(14, 4, 13, 12, 9);	set_led_rgb(15, 4, 13, 8, 4);	set_led_rgb(16, 4, 13, 5, 0);	set_led_rgb(17, 4, 13, 5, 0);	set_led_rgb(18, 4, 13, 5, 0);	set_led_rgb(19, 4, 13, 5, 0);
+  set_led_rgb(0, 5, 13, 5, 0);	set_led_rgb(1, 5, 13, 5, 0);	set_led_rgb(2, 5, 13, 5, 0);	set_led_rgb(3, 5, 13, 6, 2);	set_led_rgb(4, 5, 13, 12, 10);	set_led_rgb(5, 5, 13, 12, 10);	set_led_rgb(6, 5, 13, 12, 10);	set_led_rgb(7, 5, 13, 11, 10);	set_led_rgb(8, 5, 13, 5, 0);	set_led_rgb(9, 5, 13, 5, 0);	set_led_rgb(10, 5, 13, 5, 0);	set_led_rgb(11, 5, 13, 12, 10);	set_led_rgb(12, 5, 13, 12, 10);	set_led_rgb(13, 5, 13, 12, 10);	set_led_rgb(14, 5, 13, 12, 9);	set_led_rgb(15, 5, 13, 8, 4);	set_led_rgb(16, 5, 13, 5, 0);	set_led_rgb(17, 5, 13, 5, 0);	set_led_rgb(18, 5, 13, 5, 0);	set_led_rgb(19, 5, 13, 5, 0);
+  set_led_rgb(0, 6, 13, 5, 0);	set_led_rgb(1, 6, 13, 5, 0);	set_led_rgb(2, 6, 13, 5, 0);	set_led_rgb(3, 6, 13, 5, 1);	set_led_rgb(4, 6, 13, 8, 4);	set_led_rgb(5, 6, 13, 8, 4);	set_led_rgb(6, 6, 13, 8, 4);	set_led_rgb(7, 6, 13, 8, 4);	set_led_rgb(8, 6, 13, 5, 0);	set_led_rgb(9, 6, 13, 5, 0);	set_led_rgb(10, 6, 13, 5, 0);	set_led_rgb(11, 6, 13, 8, 4);	set_led_rgb(12, 6, 13, 8, 4);	set_led_rgb(13, 6, 13, 8, 4);	set_led_rgb(14, 6, 13, 8, 4);	set_led_rgb(15, 6, 13, 6, 2);	set_led_rgb(16, 6, 13, 5, 0);	set_led_rgb(17, 6, 13, 5, 0);	set_led_rgb(18, 6, 13, 5, 0);	set_led_rgb(19, 6, 13, 5, 0);
+  set_led_rgb(0, 7, 13, 5, 0);	set_led_rgb(1, 7, 13, 5, 0);	set_led_rgb(2, 7, 13, 5, 0);	set_led_rgb(3, 7, 13, 5, 0);	set_led_rgb(4, 7, 13, 5, 0);	set_led_rgb(5, 7, 13, 5, 0);	set_led_rgb(6, 7, 13, 5, 0);	set_led_rgb(7, 7, 13, 5, 0);	set_led_rgb(8, 7, 13, 5, 0);	set_led_rgb(9, 7, 13, 5, 0);	set_led_rgb(10, 7, 13, 5, 0);	set_led_rgb(11, 7, 13, 5, 0);	set_led_rgb(12, 7, 13, 5, 0);	set_led_rgb(13, 7, 13, 5, 0);	set_led_rgb(14, 7, 13, 5, 0);	set_led_rgb(15, 7, 13, 5, 0);	set_led_rgb(16, 7, 13, 5, 0);	set_led_rgb(17, 7, 13, 5, 0);	set_led_rgb(18, 7, 13, 5, 0);	set_led_rgb(19, 7, 13, 5, 0);
+  set_led_rgb(0, 8, 13, 5, 0);	set_led_rgb(1, 8, 13, 5, 0);	set_led_rgb(2, 8, 13, 5, 0);	set_led_rgb(3, 8, 13, 5, 0);	set_led_rgb(4, 8, 13, 5, 0);	set_led_rgb(5, 8, 13, 9, 6);	set_led_rgb(6, 8, 13, 12, 10);	set_led_rgb(7, 8, 13, 12, 10);	set_led_rgb(8, 8, 13, 12, 10);	set_led_rgb(9, 8, 13, 12, 10);	set_led_rgb(10, 8, 13, 12, 10);	set_led_rgb(11, 8, 13, 12, 10);	set_led_rgb(12, 8, 13, 12, 10);	set_led_rgb(13, 8, 13, 10, 8);	set_led_rgb(14, 8, 13, 5, 0);	set_led_rgb(15, 8, 13, 5, 0);	set_led_rgb(16, 8, 13, 5, 0);	set_led_rgb(17, 8, 13, 5, 0);	set_led_rgb(18, 8, 13, 5, 0);	set_led_rgb(19, 8, 13, 6, 2);
+  set_led_rgb(0, 9, 14, 11, 8);	set_led_rgb(1, 9, 14, 11, 9);	set_led_rgb(2, 9, 14, 11, 9);	set_led_rgb(3, 9, 13, 10, 7);	set_led_rgb(4, 9, 13, 9, 6);	set_led_rgb(5, 9, 13, 11, 8);	set_led_rgb(6, 9, 13, 12, 10);	set_led_rgb(7, 9, 13, 12, 10);	set_led_rgb(8, 9, 13, 12, 10);	set_led_rgb(9, 9, 13, 12, 10);	set_led_rgb(10, 9, 13, 12, 10);	set_led_rgb(11, 9, 13, 12, 10);	set_led_rgb(12, 9, 13, 12, 10);	set_led_rgb(13, 9, 13, 11, 9);	set_led_rgb(14, 9, 13, 9, 6);	set_led_rgb(15, 9, 14, 10, 7);	set_led_rgb(16, 9, 14, 11, 9);	set_led_rgb(17, 9, 14, 11, 9);	set_led_rgb(18, 9, 14, 11, 9);	set_led_rgb(19, 9, 14, 11, 9);
+}
+


Update senderSerialAr_4a.ino

Update senderSerialAr_4a.ino

--- arduino/senderSerialAr_4a/senderSerialAr_4a.ino
+++ arduino/senderSerialAr_4a/senderSerialAr_4a.ino
@@ -28,7 +28,7 @@

 int ledPin[]={7, 6, 5, 4, 3, 2};
-int sensorPin[]={30, 32, 34, 36, 38, 40};
+int sensorPin[]={40, 38, 36, 34, 32, 30};
 int valSensor[ARRAY_SIZE];
 int value[ARRAY_SIZE];


Fixing Arduino code to enable the Lights on AUX1/P11 on the cape

--- OpenROV/OpenROV.ino
+++ OpenROV/OpenROV.ino
@@ -25,7 +25,7 @@
   pinMode(13, OUTPUT);

   tilt.attach(3);
-  light.attach(6);
+  light.attach(5);

   motors.reset();
   led.reset();
@@ -56,8 +56,8 @@
     }
     else if (cmd.cmp("light")) {
       cmd.parse(array);
-      int light = array[1];
-      led.write(light);
+      int value = array[1];
+      light.write(value);
     }
     else {
       motors.stop();


- Improve HelloMesh.ino.

- Improve HelloMesh.ino.

--- libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino
+++ libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino
@@ -50,21 +50,21 @@
 bool meshMessageHandler(String &message, FloodingMesh &meshInstance) {
   int32_t delimiterIndex = message.indexOf(meshInstance.broadcastMetadataDelimiter());
   if (delimiterIndex == 0) {
-    Serial.print("Message received from STA " + meshInstance.getEspnowMeshBackend().getSenderMac() + ": ");
-    Serial.println(message.substring(1, 101));
+    Serial.print("Message received from STA MAC " + meshInstance.getEspnowMeshBackend().getSenderMac() + ": ");
+    Serial.println(message.substring(2, 102));

-    String potentialMac = message.substring(1, 13);
+    String potentialMac = message.substring(2, 14);

-    if (potentialMac > theOneMac) {
-      if (theOne) {
-        if (useLED) {
-          digitalWrite(LED_BUILTIN, HIGH); // Turn LED off (LED is active low)
-        }
-
+    if (potentialMac >= theOneMac) {
+      if (potentialMac > theOneMac) {
         theOne = false;
+        theOneMac = potentialMac;
       }

-      theOneMac = potentialMac;
+      if (useLED && !theOne) {
+        bool ledState = message.charAt(1) == '1';
+        digitalWrite(LED_BUILTIN, ledState); // Turn LED on/off (LED is active low)
+      }

       return true;
     } else {
@@ -142,6 +142,7 @@

 int32_t timeOfLastProclamation = -10000;
 void loop() {
+  static bool ledState = 1;
   static uint32_t benchmarkCount = 0;
   static uint32_t loopStart = millis();

@@ -160,7 +161,10 @@
   if (theOne) {
     if (millis() - timeOfLastProclamation > 10000) {
       uint32_t startTime = millis();
-      floodingMesh.broadcast(String(floodingMesh.broadcastMetadataDelimiter()) + theOneMac + " is The One.");
+      ledState = ledState ^ bool(benchmarkCount); // Make other nodes' LEDs alternate between on and off once benchmarking begins.
+
+      // Note: The maximum length of an unencrypted broadcast message is given by floodingMesh.maxUnencryptedMessageSize(). It is around 670 bytes by default.
+      floodingMesh.broadcast(String(floodingMesh.broadcastMetadataDelimiter()) + String(ledState) + theOneMac + " is The One.");
       Serial.println("Proclamation broadcast done in " + String(millis() - startTime) + " ms.");

       timeOfLastProclamation = millis();


ESP.getResetInfo()

ESP.getResetInfo()

--- _03-hx711-scale/_03-hx711-scale-v3-adaptor/_03-hx711-scale-esp-12/_03-hx711-scale-esp-12.ino
+++ _03-hx711-scale/_03-hx711-scale-v3-adaptor/_03-hx711-scale-esp-12/_03-hx711-scale-esp-12.ino
@@ -105,10 +105,14 @@

   lastReconnectAttempt = 0;

+  String getResetInfo = "hello from ESP8266 s06 ";
+  getResetInfo += (ESP.getResetInfo().substring(0,30));
+
   if (WiFi.status() == WL_CONNECTED) {
     if (!client.connected()) {
       if  ( client.connect(MQTT::Connect((char*) clientName.c_str()).set_clean_session().set_keepalive(120))) {
-        client.publish(hellotopic, "hello from ESP8266 s06 with reset");
+        //client.publish(hellotopic, getResetInfo);
+        client.publish(MQTT::Publish(hellotopic, (char*) getResetInfo.c_str());
       }
     }
   }


Support at89sx mcu's by adding the possibility to specify the polarity of the target reset signal.

--- build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino
+++ build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino
@@ -121,6 +121,13 @@
   if (hbval < 32) hbdelta = -hbdelta;
   hbval += hbdelta;
   analogWrite(LED_HB, hbval);
+}
+
+static bool rst_active_high;
+
+void reset_target(bool reset)
+{
+  digitalWrite(RESET, ((reset && rst_active_high) || (!reset && !rst_active_high)) ? HIGH : LOW);
 }

 void loop(void) {
@@ -242,15 +249,24 @@
                     + buff[18] * 0x00000100
                     + buff[19];

+  // avr devices have active low reset, at89sx are active high
+  rst_active_high = (param.devicecode >= 0xe0);
 }

 void start_pmode() {
   SPI.begin();
-  digitalWrite(RESET, HIGH);
+  // SPI.begin() has configured SS as output,
+  // so SPI master mode is selected.
+  // We have defined RESET as pin 10,
+  // which for many arduino's is not the SS pin.
+  // So we have to configure RESET as output here,
+  // (reset_target() first sets the level correct)
+  reset_target(false);
   pinMode(RESET, OUTPUT);
+
   digitalWrite(SCK, LOW);
   delay(20);
-  digitalWrite(RESET, LOW);
+  reset_target(true);
   delay(50);
   spi_transaction(0xAC, 0x53, 0x00, 0x00);
   pmode = 1;
@@ -258,7 +274,7 @@

 void end_pmode() {
   SPI.end();
-  digitalWrite(RESET, HIGH);
+  reset_target(false);
   pinMode(RESET, INPUT);
   pmode = 0;
 }


fixed measuretemperature now, void and sets global variabl, error because declared as int

--- arduino/brew_kettle/brew_kettle.ino
+++ arduino/brew_kettle/brew_kettle.ino
@@ -17,7 +17,7 @@
 double temperature;
 double setpoint;
 double dutyCycle;
-PID temperaturePID(&temperature, &dutyCycle, &setpoint, 10, 0, 0, DIRECT);
+PID temperaturePID(&temperature, &dutyCycle, &setpoint, 50, 0, 0, DIRECT);

 const int adcSubstract = 51;
 const int adcMax = 784;
@@ -99,20 +99,21 @@
   char temp[5];
   itoa(temperatureToInt(temperature), temp, 10);
   cmdMessenger.sendCmd(kTEMPERATURE, temp);
+  Serial << temperature;
 }

 void arduino_ready() {
   // In response to ping. We just send a throw-away ack to say "im alive"
-  cmdMessenger.sendCmd(kSTATUS,"Arduino ready");
+  /* cmdMessenger.sendCmd(kSTATUS,"Arduino ready"); */
 }

 void unknownCmd()
 {
   // Default response for unknown commands and corrupt messages
-  cmdMessenger.sendCmd(kERR,"Unknown command");
-}
-
-int measureTemperature() {
+  /* cmdMessenger.sendCmd(kERR,"Unknown command"); */
+}
+
+void measureTemperature() {
   int index = analogRead(A0) - adcSubstract;
   if (index < 0)
   {
@@ -122,12 +123,12 @@
   {
     index = adcMax;
   }
-  int temperature = pgm_read_word(&temperatureTable[index]);
-  return double(temperature)/10;
+  int lookup = pgm_read_word(&temperatureTable[index]);
+  temperature = double(lookup)/10.0;
 }

 int temperatureToInt(double temperature) {
-  return int(10*temperature);
+  return int(round(10*temperature));
 }

 unsigned long windowStartTime;
@@ -221,12 +222,14 @@
   cmdMessenger.feedinSerialData();

   if (currentMillis - previousMillis > 100) {
+    measureTemperature();
     temperaturePID.Compute();
     controlHeater();
-    temperature = measureTemperature();
     previousMillis = currentMillis;
     slowCount++;
     if (slowCount > 50) {
+      Serial << temperature << ENDMSG;
+      Serial << analogRead(A0) << ENDMSG;
       Serial << STATMSG << "Duty Cycle is " << dutyCycle << ENDMSG;
       slowCount = 0;
     }


COH-71: making compile when non-secure

COH-71: making compile when non-secure

--- Arduino/COHEAT2015/20160316-COHEAT-M1/COHEAT-M1/COHEAT-M1.ino
+++ Arduino/COHEAT2015/20160316-COHEAT-M1/COHEAT-M1/COHEAT-M1.ino
@@ -1081,6 +1081,7 @@
       Serial.print(' ');
       Serial.print('s'); // Indicate syncing with trailing lower-case 's' in field...
       }
+#if defined(ENABLE_OTSECUREFRAME_ENCODING_SUPPORT)
     // Now show TX ID for secure association.
     Serial.print(F(" TX ID"));
     uint8_t idbuf[OTV0P2BASE::OpenTRV_Node_ID_Bytes];
@@ -1090,6 +1091,7 @@
       Serial.print(' ');
       Serial.print(idbuf[i], HEX);
       }
+#endif // defined(ENABLE_OTSECUREFRAME_ENCODING_SUPPORT)
     Serial.println();
     }
   // Terminate line.


New 'A,0000' command sets address bus to given value.

Useful for debugging shift-register wiring and the resulting address bus
byte order.

e.g. `A,00FF` should only set A0..A7 high.

--- Arduino/MEEPROMMERfirmware/MEEPROMMERfirmware.ino
+++ Arduino/MEEPROMMERfirmware/MEEPROMMERfirmware.ino
@@ -58,6 +58,7 @@
 //define COMMANDS
 #define NOCOMMAND    0
 #define VERSION      1
+#define SET_ADDRESS  2

 #define READ_HEX    10
 #define READ_BIN    11
@@ -312,6 +313,9 @@
   lineLength=hexByte(cmdbuf+12);
   byte retval = 0;
   switch(cmdbuf[0]) {
+  case 'A':
+    retval = SET_ADDRESS;
+    break;
   case 'R':
     retval = READ_HEX;
     break;
@@ -503,6 +507,14 @@
   byte cmd = parseCommand();
   int bytes = 0;
   switch(cmd) {
+  case SET_ADDRESS:
+    // Set the address bus to an arbitrary value.
+    // Useful for debugging shift-register wiring, byte-order.
+    // e.g. A,00FF
+    Serial.print("Setting address bus to 0x");
+    Serial.println(cmdbuf + 2);
+    set_address_bus(startAddress);
+    break;
   case READ_HEX:
     //set a default if needed to prevent infinite loop
     if(lineLength==0) lineLength=32;


Add possibility to change output via serial command 'r' for raw data 'f' for filtered fusion data 'd' for debug text data

--- Arduino/MPU9150_MS5611_IMU/MPU9150_MS5611_IMU.ino
+++ Arduino/MPU9150_MS5611_IMU/MPU9150_MS5611_IMU.ino
@@ -84,7 +84,6 @@
 */

 #define USE_MAVLINK //Uncomment this line to use mavlink
-#define RAW_DATA //Uncomment this line to get raw data for sensor calibration
 #ifdef USE_MAVLINK
   #include "MavlinkForArduino.h"        // Mavlink interface
 #endif
@@ -135,6 +134,16 @@
 #define Kp 2.0f * 5.0f // these are the free parameters in the Mahony filter and fusion scheme, Kp for proportional feedback, Ki for integral
 #define Ki 0.0f

+#define RAW       0
+#define FUSION    1
+#define DEBUG     2
+short outputMode = FUSION;
+
+// String management
+String inputString = "";         // a string to hold incoming data
+boolean stringComplete = false;  // whether the string is complete
+
+
 int16_t a1, a2, a3, g1, g2, g3, m1, m2, m3;     // raw data arrays reading
 uint16_t last_output_ms = 0;  // used to control display output rate
 uint16_t delt_t_ms = 0; // used to control display output rate
@@ -172,6 +181,8 @@
   // join I2C bus (I2Cdev library doesn't do this automatically)
   Wire.begin();
   Serial.begin(57600); // Start serial at 57600 bps
+  // Reserve bytes for the inputString:
+  inputString.reserve(200);

   delay(2000);

@@ -234,16 +245,25 @@
  time loop() runs, so using delay inside loop can delay
  response.  Multiple bytes of data may be available.
  */
-void serialEvent() {
+void serialEvent()
+{
   while (Serial.available()) {
-    // get the new byte:
+    // Get the new byte:
     char inChar = (char)Serial.read();
+    // Add it to the inputString:
+    inputString += inChar;
+    // If the incoming character is a newline, set a flag
+    // so the main loop can do something about it:
+    if (inChar == '\n') {
+      stringComplete = true;
+    }
   }
 }
+

 void loop()
 {
-
+    processSerialInput();
     if (fabs(millis()-last_baro_read_ms)>1./BaroRate)
     {
       last_baro_read_ms = millis();
@@ -327,23 +347,32 @@
       // Initialize the required buffers
       mavlink_message_t msg;
       uint8_t buf[MAVLINK_MAX_PACKET_LEN];
-      mavlink_msg_heartbeat_pack(system_id, component_id, &msg, MAV_TYPE_KITE, MAV_AUTOPILOT_GENERIC, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
-      uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
-      Serial.write(buf, len);
+      uint16_t len;

-      //static inline uint16_t mavlink_msg_attitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
-      //  uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
-      mavlink_msg_attitude_pack(system_id, component_id, &msg, time_boot_ms, roll, pitch, yaw, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f);
-      len = mavlink_msg_to_send_buffer(buf, &msg);
-      Serial.write(buf, len);
+      if ((outputMode == FUSION)||(outputMode == RAW))
+      {
+        mavlink_msg_heartbeat_pack(system_id, component_id, &msg, MAV_TYPE_KITE, MAV_AUTOPILOT_GENERIC, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
+        len = mavlink_msg_to_send_buffer(buf, &msg);
+        Serial.write(buf, len);
+      }

-  #ifdef RAW_DATA
-      //static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
-      //						       uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
-      mavlink_msg_highres_imu_pack(system_id, component_id, &msg, (uint64_t)time_boot_us, ax_g*9.81, ay_g*9.81, az_g*9.81, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f, mx, my, mz, press, press, altitude, temperature, a1);
-      len = mavlink_msg_to_send_buffer(buf, &msg);
-      Serial.write(buf, len);
-  #endif
+      if (outputMode == FUSION)
+      {
+        //static inline uint16_t mavlink_msg_attitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
+        //  uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
+        mavlink_msg_attitude_pack(system_id, component_id, &msg, time_boot_ms, roll, pitch, yaw, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f);
+        len = mavlink_msg_to_send_buffer(buf, &msg);
+        Serial.write(buf, len);
+      }
+
+      if (outputMode == RAW)
+      {
+        //static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
+        //						       uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
+        mavlink_msg_highres_imu_pack(system_id, component_id, &msg, (uint64_t)time_boot_us, ax_g*9.81, ay_g*9.81, az_g*9.81, gx_degps*PI/180.0f, gy_degps*PI/180.0f, gz_degps*PI/180.0f, mx, my, mz, press, press, altitude, temperature, a1);
+        len = mavlink_msg_to_send_buffer(buf, &msg);
+        Serial.write(buf, len);
+      }
       /*
       //mavlink_msg_scaled_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
       // uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag)
@@ -356,39 +385,40 @@
       Serial.write(buf, len);
       */

-#else
-      Serial.print("ax = "); Serial.print((int)1000*ax_g);
-      Serial.print(" ay = "); Serial.print((int)1000*ay_g);
-      Serial.print(" az = "); Serial.print((int)1000*az_g); Serial.println(" mg");
-      Serial.print("gx = "); Serial.print( gx_degps, 2);
-      Serial.print(" gy = "); Serial.print( gy_degps, 2);
-      Serial.print(" gz = "); Serial.print( gz_degps, 2); Serial.println(" deg/s");
-      Serial.print("mx = "); Serial.print( (int)mx );
-      Serial.print(" my = "); Serial.print( (int)my );
-      Serial.print(" mz = "); Serial.print( (int)mz ); Serial.println(" mG");
-
-      Serial.print("q0 = "); Serial.print(q[0]);
-      Serial.print(" qx = "); Serial.print(q[1]);
-      Serial.print(" qy = "); Serial.print(q[2]);
-      Serial.print(" qz = "); Serial.println(q[3]);
-      Serial.print("Yaw, Pitch, Roll: ");
-      Serial.print(yaw*180.0f / PI, 2);
-      Serial.print(", ");
-      Serial.print(pitch*180.0f / PI, 2);
-      Serial.print(", ");
-      Serial.println(roll*180.0f / PI, 2);
-
-      Serial.print("rate = "); Serial.print((float)1.0f/deltat_s, 2); Serial.println(" Hz");
-
-      Serial.print(" temp: ");
-      Serial.print(temperature);
-      Serial.print(" degC pres: ");
-      Serial.print(press);
-      Serial.print(" mbar altitude: ");
-      Serial.print(altitude);
-      Serial.println(" m");
 #endif
-
+      if (outputMode == DEBUG)
+      {
+        Serial.print("ax = "); Serial.print((int)1000*ax_g);
+        Serial.print(" ay = "); Serial.print((int)1000*ay_g);
+        Serial.print(" az = "); Serial.print((int)1000*az_g); Serial.println(" mg");
+        Serial.print("gx = "); Serial.print( gx_degps, 2);
+        Serial.print(" gy = "); Serial.print( gy_degps, 2);
+        Serial.print(" gz = "); Serial.print( gz_degps, 2); Serial.println(" deg/s");
+        Serial.print("mx = "); Serial.print( (int)mx );
+        Serial.print(" my = "); Serial.print( (int)my );
+        Serial.print(" mz = "); Serial.print( (int)mz ); Serial.println(" mG");
+
+        Serial.print("q0 = "); Serial.print(q[0]);
+        Serial.print(" qx = "); Serial.print(q[1]);
+        Serial.print(" qy = "); Serial.print(q[2]);
+        Serial.print(" qz = "); Serial.println(q[3]);
+        Serial.print("Yaw, Pitch, Roll: ");
+        Serial.print(yaw*180.0f / PI, 2);
+        Serial.print(", ");
+        Serial.print(pitch*180.0f / PI, 2);
+        Serial.print(", ");
+        Serial.println(roll*180.0f / PI, 2);
+
+        Serial.print("rate = "); Serial.print((float)1.0f/deltat_s, 2); Serial.println(" Hz");
+
+        Serial.print(" temp: ");
+        Serial.print(temperature);
+        Serial.print(" degC pres: ");
+        Serial.print(press);
+        Serial.print(" mbar altitude: ");
+        Serial.print(altitude);
+        Serial.println(" m");
+      }

       // With these settings the filter is updating at a ~145 Hz rate using the Madgwick scheme and
       // >200 Hz using the Mahony scheme even though the display refreshes at only 2 Hz.
@@ -402,6 +432,29 @@
       // produced by the on-board Digital Motion Processor of Invensense's MPU6050 6 DoF and MPU9150 9DoF sensors.
       // The 3.3 V 8 MHz Pro Mini is doing pretty well!
     }
+}
+void processSerialInput()
+{
+  // Print the string when a newline arrives:
+  if (stringComplete)
+  {
+    if (inputString.startsWith("r"))
+    {
+      outputMode = RAW;
+    }
+    else if (inputString.startsWith("f"))
+    {
+      outputMode = FUSION;
+    }
+    else if (inputString.startsWith("d"))
+    {
+      outputMode = DEBUG;
+    }
+
+    // Clear the string:
+    inputString = "";
+    stringComplete = false;
+  }
 }
 void getBaroData()
 {


add missing semicolon in wifi script

add missing semicolon in wifi script

--- files/template_home_wifi/template_home_wifi.ino
+++ files/template_home_wifi/template_home_wifi.ino
@@ -65,7 +65,7 @@
     Serial.println();
     Serial.print("Waiting 60 seconds for connection...");
     delay(60000);
-    Serial.println("done.")
+    Serial.println("done.");
   }
   Serial.print("Initializing sensors...");
   Wire.begin();


Fixed more "sloppy programming"

Fixed more "sloppy programming"

--- examples/bounce_basic/bounce_basic.ino
+++ examples/bounce_basic/bounce_basic.ino
@@ -28,7 +28,7 @@
 Bounce bounce = Bounce();

 // SET A VARIABLE TO STORE THE LED STATE
-bool ledState = LOW;
+int ledState = LOW;

 void setup() {


Added delay in setup for more robust power on glitch behavior

--- ATtiny/ls_bm2014/ls_bm2014.ino
+++ ATtiny/ls_bm2014/ls_bm2014.ino
@@ -133,6 +133,16 @@
     // disable watchdog - probably have only 15 ms, hope we can do this in time
     MCUSR = 0;
     wdt_disable();
+
+    // Wait and hope the power is done glitching, may make setup more robust
+    // There was correlation between experimental power glitches and
+    // trashing of tile address in EEPROM
+    // Once saw an apparent 1/8 clock rate error
+    // Maybe more robust serial rate setup
+    int delayMs = 200;
+    delay(delayMs);
+    // TODO - maybe 200 code bytes for first delay()?
+    // TODO - use alternate delay with updateLedMs and millis()

 // http://embeddedgurus.com/stack-overflow/2009/05/checking-the-fuse-bits-in-an-atmel-avr-at-run-time/
     //char fuse_low = _SPM_GET_LOW_FUSEBITS();
@@ -254,7 +264,7 @@
         {
             processSegmentCmd(mode);
         }
-        modeChanged = false;
+        modeChanged = false; // TODO - looks redundant
     }

     // end processing this command with a display update if needed
@@ -504,12 +514,14 @@
                     if (((firstByte & 0xf8) == busAddress) || ((firstByte & 0xf8) == 0))
                     {
                         done = true; // command parser picks up next
+                        dbgBlip(1); // blip SEGDIN
                         logChar = 0xCC; // complete command acquired
                     }
                     // this tile was not addressed
                     else
                     {
                         done = false; // throw out this command
+                        dbgBlip(2); // blip SEGDIN
                         //logChar = 0xCE; // not good to send in a system
                         //mySerial.write(commandBytes, 3); // HACK TEMP - want to see errors on scope
                     }
@@ -1621,6 +1633,19 @@
     return timeout;
 }

+// debug output on SEGDIN line to MAX - use only when not using SPI to MAX
+void dbgBlip(int count)
+{
+    // looks like MAX driver leaves SEGDIN usually low
+    for (int i=0; i<count; i++)
+    {
+#if false
+        digitalWrite(SEGDIN, HIGH);
+        digitalWrite(SEGDIN, LOW);
+#endif
+    }
+}
+
 // use this write for debug output
 inline void dlog (char thisChar)
 {


Added tested display sizes

Added tested display sizes

--- usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino
+++ usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino
@@ -16,9 +16,9 @@
 // https://github.com/olikraus/u8g2/wiki/u8x8setupcpp
 // or check the gallery:
 // https://github.com/olikraus/u8g2/wiki/gallery
-// --> First choise of cheap I2C OLED 128X32
+// --> First choise of cheap I2C OLED 128X32 0.91"
 U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA
-// --> Second choise of cheap I2C OLED 128X64
+// --> Second choise of cheap I2C OLED 128X64 0.96" or 1.3"
 //U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA
 // gets called once at boot. Do all initialization that doesn't depend on
 // network here


Cleanup documentation.

Cleanup documentation.

--- examples/Ethernet/CosaSDWebServer/CosaSDWebServer.ino
+++ examples/Ethernet/CosaSDWebServer/CosaSDWebServer.ino
@@ -34,24 +34,18 @@
  * This file is part of the Arduino Che Cosa project.
  */

-#include "Cosa/Memory.h"
-#include "Cosa/InputPin.hh"
-#include "Cosa/AnalogPin.hh"
 #include "Cosa/Watchdog.hh"
+#include "Cosa/IOStream/Driver/UART.hh"
 #include "Cosa/Trace.hh"
-#include "Cosa/INET.hh"
+#include "Cosa/Socket/Driver/W5100.hh"
 #include "Cosa/INET/HTTP.hh"
-#include "Cosa/IOStream/Driver/UART.hh"
-#include "Cosa/Socket/Driver/W5100.hh"
 #include "Cosa/SPI/Driver/SD.hh"
 #include "Cosa/FS/FAT16.hh"
-
-#define USE_ETHERNET_SHIELD

 // HTML end of line
 #define CRLF "\r\n"

-// Example WebServer that responds with file from SD/FAT16
+// Example WebServer that responds by reading SD/FAT16 file
 class WebServer : public HTTP::Server {
 public:
   virtual void on_request(IOStream& page, char* method, char* path, char* query);


Update SDWriter_wApp_wLog.ino

Update SDWriter_wApp_wLog.ino

--- examples/02-Utility/SDWriter_wApp_wLog/SDWriter_wApp_wLog.ino
+++ examples/02-Utility/SDWriter_wApp_wLog/SDWriter_wApp_wLog.ino
@@ -48,7 +48,7 @@
 // /////////// Create classes for controlling the system, espcially via USB Serial and via the App
 #include      "SerialManager.h"
 #include      "State.h"
-BLE_UI        ble(&myTympan);           //create bluetooth BLE class
+BLE_UI        ble(&Serial1);           //create bluetooth BLE class
 SerialManager serialManager(&ble);     //create the serial manager for real-time control (via USB or App)
 State         myState(&audio_settings, &myTympan, &serialManager); //keeping one's state is useful for the App's GUI


TrebleBoost_wApp: improve description at top

--- examples/06-AppTutorial/TrebleBoost_wApp/TrebleBoost_wApp.ino
+++ examples/06-AppTutorial/TrebleBoost_wApp/TrebleBoost_wApp.ino
@@ -7,19 +7,19 @@
 *   As a tutorial on how to interact with the mobile phone App, you should first explote the previous
 *   example, which was "BasicGain_wApp".
 *
-*   Here in "TrebleBoost_wApp", we started with the example sketch "01-Basic\BasicGain" and added
-*   the App functionality.  It starts with the same features of "BasicGain_wApp" and adds new
-*   App-related features so that you can see a more complicated example.
-*
-*   Like the previous example shows you:
+*   Here in "TrebleBoost_wApp", we started with the example sketch "01-Basic\TrebleBoost" and added
+*   the App functionality.  The App functionality in "TrebleBoost_wApp" is the same as
+*   "BasicGain_wApp" but adds features so that you can see a more complicated example.
+*
+*   Like any App-enabled sketch, this example shows you:
 *      * How to use Tympan code here to define a graphical interface (GUI) in the App
 *      * How to transmit that GUI to the App
 *      * How to respond to the commands coming back from the App
 *
-*   This example extends the previous example by:
-*      * Adding more buttons groups ("cards") to the previous example's GUI
-*      * Adding another page to the GUI
-*      * Adding a button that you can illuminate to indicate state
+*   Compared to the previous example, this sketch:
+*      * Adds more buttons groups ("cards") to the previous example's GUI
+*      * Adds another page to the GUI
+*      * Adds a button that you can illuminate to indicate state
 *
 *   MIT License.  use at your own risk.
 */


Testing Wireless NRF24L0P monitor on 2004 LCD.

--- examples/Wireless/CosaWirelessMonitor/CosaWirelessMonitor.ino
+++ examples/Wireless/CosaWirelessMonitor/CosaWirelessMonitor.ino
@@ -36,8 +36,8 @@

 // Select Wireless device driver
 // #define USE_CC1101
-// #define USE_NRF24L01P
-#define USE_RFM69
+#define USE_NRF24L01P
+// #define USE_RFM69
 // #define USE_VWI

 #if defined(USE_CC1101)
@@ -67,19 +67,19 @@
 static const uint8_t IOSTREAM_TYPE = 0x00;

 // Select IOStream device
-#include "Cosa/IOStream/Driver/UART.hh"
+// #include "Cosa/IOStream/Driver/UART.hh"

 // LCD and communication port
-// #include "Cosa/LCD/Driver/HD44780.hh"
+#include "Cosa/LCD/Driver/HD44780.hh"
 // HD44780::Port4b port;
 // HD44780::SR3W port;
 // HD44780::SR3WSPI port;
 // HD44780::SR4W port;
-// HD44780::MJKDZ port;
+HD44780::MJKDZ port;
 // HD44780::GYIICLCD port;
 // HD44780::DFRobot port;
 // HD44780 lcd(&port);
-// HD44780 lcd(&port, 20, 4);
+HD44780 lcd(&port, 20, 4);

 const uint8_t bitmaps[] __PROGMEM = {
   // Bar(1)


make demo/sample Olimex

make demo/sample Olimex

--- lib-arduino/ACNode/examples/SampleNode/SampleNode.ino
+++ lib-arduino/ACNode/examples/SampleNode/SampleNode.ino
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 */
-// #include <PowerNodeV11.h> -- this is an olimex board.
+#include <PowerNodeV11.h> -- this is an olimex board.

 #include <WiFiClientSecure.h>
 #include <Wire.h>


updated and modified AnalogReadSerial example

--- html/examples/01.Basics/AnalogReadSerial/AnalogReadSerial.ino
+++ html/examples/01.Basics/AnalogReadSerial/AnalogReadSerial.ino
@@ -1,22 +1,34 @@
 /*
   AnalogReadSerial
-  Reads an analog input on pin 0, prints the result to the serial monitor.
-  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
+  Reads an analog input on pin 1, prints the result to the serial monitor.
+
+  Attach the center pin of a potentiometer to pin A1,
+  and the outside pins to A0 (set to gnd) and A2 (set to VMCU).

  This example code is in the public domain.
  */

 // the setup routine runs once when you press reset:
 void setup() {
-  // initialize serial communication at 9600 bits per second:
-  Serial.begin(9600);
+  // the chibitronics implementation always runs at 115200 regardless of the argument
+  Serial.begin(115200);
+
+  pinMode(A0, OUTPUT);
+  digitalWrite(A0, LOW);   // A0 is the - reference
+
+  pinMode(A2, OUTPUT);
+  digitalWrite(A2, HIGH);  // A2 is the + voltage
+
+  pinMode(A1, INPUT);      // A1 is the sensor input
 }

 // the loop routine runs over and over again forever:
 void loop() {
-  // read the input on analog pin 0:
-  int sensorValue = analogRead(A0);
+  // read the input on analog pin 1:
+  int sensorValue = analogRead(A1);
+
   // print out the value you read:
   Serial.println(sensorValue);
+
   delay(1);        // delay in between reads for stability
 }


Updated aci_pins

Updated aci_pins

--- demos/ble_temperature_template/ble_temperature_template.ino
+++ demos/ble_temperature_template/ble_temperature_template.ino
@@ -363,16 +363,16 @@
   Tell the ACI library, the MCU to nRF8001 pin connections.
   The Active pin is optional and can be marked UNUSED
   */
-  aci_state.aci_pins.board_name = BOARD_DEFAULT; //See board.h for details
-  aci_state.aci_pins.reqn_pin   = SS;
-  aci_state.aci_pins.rdyn_pin   = 3;
+  aci_state.aci_pins.board_name = REDBEARLAB_SHIELD_V1_1; //See board.h for details
+  aci_state.aci_pins.reqn_pin   = 9;
+  aci_state.aci_pins.rdyn_pin   = 8;
   aci_state.aci_pins.mosi_pin   = MOSI;
   aci_state.aci_pins.miso_pin   = MISO;
   aci_state.aci_pins.sck_pin    = SCK;

   aci_state.aci_pins.spi_clock_divider     = SPI_CLOCK_DIV8;

-  aci_state.aci_pins.reset_pin             = 4;
+  aci_state.aci_pins.reset_pin             = UNUSED;
   aci_state.aci_pins.active_pin            = UNUSED;
   aci_state.aci_pins.optional_chip_sel_pin = UNUSED;


any button can turn on backlight and reset mcb

--- short-circuit-limiter/short-circuit-limiter.ino
+++ short-circuit-limiter/short-circuit-limiter.ino
@@ -6,9 +6,12 @@

 #define PIN_LED 26
 #define PIN_CT A0
-#define PIN_BUTTON_ENTER 24
 #define PIN_TEMP A11
 #define PIN_BUZZER 4
+
+#define PIN_BUTTON_UP 25
+#define PIN_BUTTON_ENTER 24
+#define PIN_BUTTON_DOWN 23

 #define PIN_RELAY_MCB 5
 #define PIN_RELAY_LIMITER 7
@@ -56,8 +59,11 @@

   pinMode(PIN_RELAY_LIMITER, OUTPUT);
   pinMode(PIN_RELAY_MCB, OUTPUT);
+  pinMode(PIN_TEMP, INPUT);
+
+  pinMode(PIN_BUTTON_UP, INPUT);
   pinMode(PIN_BUTTON_ENTER, INPUT);
-  pinMode(PIN_TEMP, INPUT);
+  pinMode(PIN_BUTTON_DOWN, INPUT);

   changeDisplayBacklight(true);
   passFullCurrentThrough(false);
@@ -274,11 +280,7 @@

   }

-
-
-  int buttonPressed = digitalRead(PIN_BUTTON_ENTER);
-
-  if(buttonPressed == LOW){
+  if(isAtLeastOneButtonPressed()){
     return STATE_WINDOW_BEFORE;
   }

@@ -295,6 +297,10 @@
     currentState = STATE_WINDOW_BEFORE;
     Serial.println("Window Before");
     shortBeepXTimesNoDelay(2);
+  }
+
+  if(isAtLeastOneButtonPressed()){
+    changeDisplayBacklight(true);
   }

@@ -396,6 +402,18 @@
   return temperatureC;
 }

+bool isAtLeastOneButtonPressed(){
+
+  int upPressed = digitalRead(PIN_BUTTON_UP);
+  int enterPressed = digitalRead(PIN_BUTTON_ENTER);
+  int downPressed = digitalRead(PIN_BUTTON_DOWN);
+
+  if(upPressed == LOW || enterPressed == LOW || downPressed == LOW){
+    return true;
+  } else {
+    return false;
+  }
+}

 void shortBeepXTimesNoDelay(int times){
   beepsLeft = times;


arduino switch BT rx,tx pins

arduino switch BT rx,tx pins

--- Arduino/TurquoiseBicuspidATTinyBLE.ino
+++ Arduino/TurquoiseBicuspidATTinyBLE.ino
@@ -1,12 +1,12 @@
 #include <SoftwareSerial.h>

 // ATtiny settings: ATtiny85 @8MHz (internal oscillator; BOD disabled), burn bootloader
-SoftwareSerial btSerial(3, 2); // ATtiny RX, TX: HM10 TX, RX
+SoftwareSerial btSerial(1, 2); // ATtiny RX, TX: HM10 TX, RX

 // Global
 int TIME_START = 0;
 int REDPIN = 0;
-int GREPIN = 1;
+int GREPIN = 3;
 int BLUPIN = 4;

 // Defaults


New style RFM12B have a tighter frequency cut off

At least it does on my Jeenode Micro V1 running at 8Mhz as against an
old style RFM12B on a Jeenode V5 at 16Mhz

--- examples/RF12/RF12tune/RF12tune.ino
+++ examples/RF12/RF12tune/RF12tune.ino
@@ -190,7 +190,7 @@
         rf12_sendStart(RF12_HDR_ACK, &config, sizeof config, RADIO_SYNC_MODE);
         byte acked = waitForAck();
         if (acked) {
-          return i;
+          return i; // Return number of attempts to successfully transmit
         }
       }
     return 0;


added offset for left gripper servo

added offset for left gripper servo

--- jsk_2016_01_baxter_apc/firmware/gripper_front_manager_left.ino
+++ jsk_2016_01_baxter_apc/firmware/gripper_front_manager_left.ino
@@ -50,7 +50,7 @@

 void set_angle(void)
 {
-    myservo.write((int)(-rad_to_deg(servo_angle_msg.data) + 90.0));
+    myservo.write((int)(-rad_to_deg(servo_angle_msg.data - 0.1) + 90.0));
 }

 void servo_angleCb(const std_msgs::Float32& angle_msg)


Update ArduCAM_Mini_2MP_Plus_Multi_Capture2SD.ino

--- ArduCAM/examples/mini/ArduCAM_Mini_2MP_Plus_Multi_Capture2SD/ArduCAM_Mini_2MP_Plus_Multi_Capture2SD.ino
+++ ArduCAM/examples/mini/ArduCAM_Mini_2MP_Plus_Multi_Capture2SD/ArduCAM_Mini_2MP_Plus_Multi_Capture2SD.ino
@@ -16,7 +16,7 @@
 //IF the FRAMES_NUM is 0X04, take five photos
 //IF the FRAMES_NUM is 0X05, take six photos
 //IF the FRAMES_NUM is 0X06, take seven photos
-//IF the FRAMES_NUM is 0X07, continue shooting until the FIFO is full
+//IF the FRAMES_NUM is 0XFF, continue shooting until the FIFO is full
 //You can see the picture in the SD card.
 // This program requires the ArduCAM V4.0.0 (or later) library and ArduCAM_Mini_2MP_Plus
 // and use Arduino IDE 1.6.8 compiler or above


Add ON / OFF / PAUSE / RESUME to webinterface

--- examples/ws2812fx_segments_web/ws2812fx_segments_web.ino
+++ examples/ws2812fx_segments_web/ws2812fx_segments_web.ino
@@ -136,6 +136,25 @@
     root.printTo(json, sizeof(char) * bufferSize);
     server.send(200, "application/json", json);
     free(json);
+  });
+
+  // control Run / stop / pause / resume
+  server.on("/runcontrol", HTTP_POST, [](){
+String data = server.arg("plain");
+    //Serial.println(data);
+    if (data == "pause"){
+     ws2812fx.pause();
+    }
+    if (data == "resume"){
+     ws2812fx.resume();
+    }
+    if (data == "run"){
+     ws2812fx.start();
+    }
+    if (data == "stop"){
+     ws2812fx.stop();
+    }
+    server.send(200, "text/plain", "OK");
   });

   // receive the segment info in JSON format and setup the WS2812 strip


Update lenny lol demo.

Update lenny lol demo.


Measuring display updating time

Measuring display updating time

--- ArduinoAudioSpectrumAnalyzer.ino
+++ ArduinoAudioSpectrumAnalyzer.ino
@@ -119,6 +119,8 @@

 inline void updateScreen()
 {
+	const auto start_us = micros();
+
 	FastGraphics fastTFT(tft);

 	//tft.fillRect(0, 0, 100, 55, ST7735_BLACK);
@@ -127,9 +129,9 @@
 	// Symbol heights depending on text size: 1 - 10(?), 2 - 15, 3 - 25

 	fastTFT.setTextSize(2);
-	fastTFT.setTextColor(RGB_to_565(0, 200, 255));
-	fastTFT.setCursor(0, 0);
-	fastTFT.print(minSampleValue);
+	//fastTFT.setTextColor(RGB_to_565(0, 200, 255));
+	//fastTFT.setCursor(0, 0);
+	//fastTFT.print(minSampleValue);

 	fastTFT.setTextColor(RGB_to_565(255, 0, 10));
 	fastTFT.setCursor(45, 0);
@@ -142,4 +144,9 @@
 	assert(FHT_N == 256);
 	for (int i = 1; i < 128; ++i) // What's the deal with bin 0?
 		fastTFT.drawFastVLine(i, 128 - fht_log_out[i] / 2, fht_log_out[i] / 2, RGB_to_565(255, 255, 200));
+
+	const auto elapsed = (micros() - start_us) / 1000;
+	fastTFT.setTextColor(RGB_to_565(0, 200, 255));
+	fastTFT.setCursor(0, 0);
+	fastTFT.print(elapsed);
 }


Update api.github.com certificate signature (#5145)

Fixes #5144

--- libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino
+++ libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino
@@ -27,7 +27,7 @@

 // Use web browser to view and copy
 // SHA1 fingerprint of the certificate
-const char* fingerprint = "35 85 74 EF 67 35 A7 CE 40 69 50 F3 C0 F6 80 CF 80 3B 2E 19";
+const char* fingerprint = "5F F1 60 31 09 04 3E F2 90 D2 B0 8A 50 38 04 E8 37 9F BC 76";

 void setup() {
   Serial.begin(115200);


only for boards with 2 adcs

only for boards with 2 adcs

--- examples/synchronizedMeasurements/synchronizedMeasurements.ino
+++ examples/synchronizedMeasurements/synchronizedMeasurements.ino
@@ -1,6 +1,8 @@
 /* Example for synchonized measurements using both ADC present in Teensy 3.1
 *  You can change the number of averages, bits of resolution and also the comparison value or range.
 */
+
+#ifdef ADC_DUAL_ADCS

 #include <ADC.h>
@@ -94,3 +96,7 @@

 */

+#else // make sure the example can run for any boards (automated testing)
+void setup() {}
+void loop() {}
+#endif // ADC_DUAL_ADCS


Fix compile error due to typo on 'Brightness'

--- examples/ControlBrightness/ControlBrightness.ino
+++ examples/ControlBrightness/ControlBrightness.ino
@@ -106,7 +106,7 @@
   oled.setTextXY(7,13);
   oled.putNumber(brightness);
   delay(500);
-  if(Brightness == 255)
+  if(brightness == 255)
   {
     oled.setTextXY(7,13);           // Display the brighness value starting from 7th Row, 13th Column
     oled.putString("   ");          // Clear 13,14 and 15th Columns. Numbers left aligned.


Don't use separate #defines for all drawbars

--- roto.ino
+++ roto.ino
@@ -87,15 +87,8 @@
 #define MANUAL_KEY_61 (MANUAL_KEY_0 + 61)

 #define CC_SWELL (11)
-#define CC_DRAWBAR_1 (70)
-#define CC_DRAWBAR_2 (71)
-#define CC_DRAWBAR_3 (72)
-#define CC_DRAWBAR_4 (73)
-#define CC_DRAWBAR_5 (74)
-#define CC_DRAWBAR_6 (75)
-#define CC_DRAWBAR_7 (76)
-#define CC_DRAWBAR_8 (77)
-#define CC_DRAWBAR_9 (78)
+#define CC_DRAWBAR_0 (69)
+#define CC_DRAWBAR_9 (CC_DRAWBAR_0 + 9)
 #define CC_PERCUSSION (87)
 #define CC_PERCUSSION_FAST (88)
 #define CC_PERCUSSION_SOFT (89)
@@ -120,10 +113,10 @@
     memset(midiControl, 0, 127);

     // Set drawbars to Green Onions.
-    midiControl[CC_DRAWBAR_1] = 127;
-    midiControl[CC_DRAWBAR_2] = 127;
-    midiControl[CC_DRAWBAR_3] = 127;
-    midiControl[CC_DRAWBAR_4] = 127;
+    midiControl[CC_DRAWBAR_0 + 1] = 127;
+    midiControl[CC_DRAWBAR_0 + 2] = 127;
+    midiControl[CC_DRAWBAR_0 + 3] = 127;
+    midiControl[CC_DRAWBAR_0 + 4] = 127;
 }

 void setup() {
@@ -214,15 +207,9 @@
 }

 void randomDrawbars() {
-    midiControl[CC_DRAWBAR_1] = random(0, 127);
-    midiControl[CC_DRAWBAR_2] = random(0, 127);
-    midiControl[CC_DRAWBAR_3] = random(0, 127);
-    midiControl[CC_DRAWBAR_4] = random(0, 127);
-    midiControl[CC_DRAWBAR_5] = random(0, 127);
-    midiControl[CC_DRAWBAR_6] = random(0, 127);
-    midiControl[CC_DRAWBAR_7] = random(0, 127);
-    midiControl[CC_DRAWBAR_8] = random(0, 127);
-    midiControl[CC_DRAWBAR_9] = random(0, 127);
+    for (int i = 1; i <= 9; i++) {
+        midiControl[CC_DRAWBAR_0 + i] = random(0, 127);
+    }
     updateTonewheels();
 }

@@ -317,15 +304,9 @@
     uint8_t bars[10] = {0};
     uint8_t percBars[10] = {0};

-    bars[1] = quantizeDrawbar(midiControl[CC_DRAWBAR_1]);
-    bars[2] = quantizeDrawbar(midiControl[CC_DRAWBAR_2]);
-    bars[3] = quantizeDrawbar(midiControl[CC_DRAWBAR_3]);
-    bars[4] = quantizeDrawbar(midiControl[CC_DRAWBAR_4]);
-    bars[5] = quantizeDrawbar(midiControl[CC_DRAWBAR_5]);
-    bars[6] = quantizeDrawbar(midiControl[CC_DRAWBAR_6]);
-    bars[7] = quantizeDrawbar(midiControl[CC_DRAWBAR_7]);
-    bars[8] = quantizeDrawbar(midiControl[CC_DRAWBAR_8]);
-    bars[9] = quantizeDrawbar(midiControl[CC_DRAWBAR_9]);
+    for (int i = 1; i < 10; i++) {
+        bars[i] = quantizeDrawbar(midiControl[CC_DRAWBAR_0 + i]);
+    }

     if (midiControl[CC_PERCUSSION]) {
         bars[9] = 0;
@@ -375,7 +356,7 @@
         updatePercussion();
     } else if (ctrl == CC_PERCUSSION_SOFT) {
         updatePercussion();
-    } else if (ctrl >= CC_DRAWBAR_1 && ctrl <= CC_DRAWBAR_9) {
+    } else if (ctrl > CC_DRAWBAR_0 && ctrl <= CC_DRAWBAR_9) {
         updateTonewheels();
     }
 }


Set vibrato off and don't reset Leslie position on CC changes

--- roto.ino
+++ roto.ino
@@ -121,6 +121,13 @@
     midiControl[CC_DRAWBAR_0 + 3] = 127;
     midiControl[CC_DRAWBAR_0 + 4] = 127;

+    // Reset Leslie rotation position. Our R microphone leads the L by
+    // 90 degrees.
+    leslieBassL.setPhase(0);
+    leslieTrebleL.setPhase(0);
+    leslieBassR.setPhase(0.25);
+    leslieTrebleR.setPhase(0.25);
+
     updateLeslieAmplifier();
     updateLeslieRotation();

@@ -156,7 +163,7 @@
     leslieL.gain(0, 0.70); // bass
     leslieL.gain(1, 0.30); // treble

-    vibrato.setMode(C3);
+    vibrato.setMode(Off);
     antialias.setLowpass(0, 6000, 0.707);

     audioShield.enable();
@@ -301,9 +308,6 @@
     leslieTrebleR.setTremoloDepth(0.3);
     leslieBassL.setTremoloDepth(0.5);
     leslieTrebleL.setTremoloDepth(0.3);
-
-    leslieBassR.setPhase(0.25);
-    leslieTrebleL.setPhase(0.25);

     // These Leslie speeds are from
     // http://www.dairiki.org/HammondWiki/LeslieRotationSpeed
@@ -358,7 +362,7 @@
     midiControl[ctrl] = val;

     if (ctrl == CC_SWELL) {
-        swell.gain(remap((float)val, 0, 127, 0, 5));
+        swell.gain(remap((float)val, 0, 127, 0, 2.5));
     } else if (ctrl == CC_RESET) {
         updateReset();
     } else if (ctrl == CC_PERCUSSION) {


Changed threshold values

Changed threshold values

--- working_directory/arduino_codes/arduino1/arduino1.ino
+++ working_directory/arduino_codes/arduino1/arduino1.ino
@@ -12,8 +12,8 @@
 int flag_dynamixel2_disconnected = 0;

 //THRESHOLDS
-int threshold_12v = 512; //#CHANGE
-int threshold_5v = 512; //#CHANGE
+int threshold_12v = 700; //#CHANGE
+int threshold_5v = 700; //#CHANGE
 int threshold_ldr = 512;

 //Pin Definitions


use INPUT_PULLUP for cc3000 button example

--- arduino-cc3000/button/button.ino
+++ arduino-cc3000/button/button.ino
@@ -31,7 +31,7 @@
 void setup() {

   // set button pin as an input
-  pinMode(BUTTON, INPUT);
+  pinMode(BUTTON, INPUT_PULLUP);

   // wait until serial is available
   while (!Serial);
@@ -85,7 +85,7 @@
     return;

   // send the proper value to AIO depending on button state
-  if(current == HIGH)
+  if(current == LOW)
     sendData("button", "1");
   else
     sendData("button", "0");


Update code comments

Update code comments

--- Arduino/v0.3.0_no_conditioning/v0.3.0_no_conditioning.ino
+++ Arduino/v0.3.0_no_conditioning/v0.3.0_no_conditioning.ino
@@ -1,12 +1,19 @@

-/*  Z1FFER
- *  Created by Rob Seward 2015
+/**
+ * Z1FFER v0.3.X Firmware.
+ *
+ * This code is designed to be as fast as possible.
+ * It operates two inverted clock signals on pins 9 and 10
+ * while reading in random bytes on pins 6 and 7.
+ * Pins are read and written to using the registers for speed.
+ * The clock signal is irregular but this does not effect the
+ * performance of the Z1FFER shield.
  */

 bool flip = false;
 int currentByte = 0;
 int i=0;
-
+
 void setup() {
   //Set B pins to output
   DDRB = 0b11111111;
@@ -43,5 +50,3 @@
   }
   flip = !flip;
 }
-
-


Replace jsonrpc_call with mjson_printf

Replace jsonrpc_call with mjson_printf

--- examples/ArduinoMqttExample/ArduinoMqttExample.ino
+++ examples/ArduinoMqttExample/ArduinoMqttExample.ino
@@ -18,7 +18,7 @@
 // Host controller can use it to do run-time initialisation of Cloud Connector.
 // In our case, we subscribe to the "ccm/led" MQTT topic.
 static void sys_init_cb(struct jsonrpc_request *r) {
-  jsonrpc_call(wfn, NULL, "{%Q: %Q, %Q: {%Q: %Q}}",
+  mjson_printf(wfn, NULL, "{%Q: %Q, %Q: {%Q: %Q}}",
                "method", "MQTT.Sub", "params", "topic", "ccm/led");
 }

@@ -42,7 +42,7 @@
   now = millis();
   if (old > now || old + 5000 < now) {
     old = now;
-    jsonrpc_call(wfn, NULL, "{%Q: %Q, %Q: {%Q: %Q, %Q: %lu}}",
+    mjson_printf(wfn, NULL, "{%Q: %Q, %Q: {%Q: %Q, %Q: %lu}}",
                  "method", "MQTT.Pub", "params", "topic", "ccm/data",
                  "message", now);
   }


Docs...

Docs...

--- water_heater_monitor/water_heater_monitor.ino
+++ water_heater_monitor/water_heater_monitor.ino
@@ -36,6 +36,9 @@
     postToPhant();
   }

+  // Delays allow the ESP8266 to perform critical tasks
+  // defined outside of the sketch. These tasks include
+  // setting up, and maintaining, a WiFi connection.
   delay(100);
 }


Graphical frequency scanner implemented.

--- src/cyclop_plus/cyclop_plus.ino
+++ src/cyclop_plus/cyclop_plus.ino
@@ -310,9 +310,8 @@
 //******************************************************************************
 //* function: graphicScanner
 //*         : scans the 5.8 GHz band in 3 MHz increments and draws a graphical
-//*         : representation. If the button is single pressed the currently
-//*         : scanned frequency is returned. All other click types return the
-//*         : scan start frequency
+//*         : representation. when the button is pressed the currently
+//*         : scanned frequency is returned.
 //******************************************************************************
 uint16_t graphicScanner( uint16_t frequency ) {
   uint8_t i;
@@ -321,7 +320,7 @@
   uint16_t scanFrequency = frequency;
   uint16_t bestFrequency = frequency;
   uint8_t clickType;
-  uint8_t value;
+  uint8_t rssiDisplayValue;

   // Draw screen frame etc
   drawScannerScreen();
@@ -333,16 +332,11 @@
     setRTC6715Frequency(scanFrequency);
     delay( RSSI_STABILITY_DELAY_MS );
     scanRssi = readRssi();
-    value = scanRssi / 10;      // Roughly 18 - 60
-    updateScannerScreen((FREQUENCY_MAX - scanFrequency) / 3, value );
-  }
-
-  if (clickType != SINGLE_CLICK )
-    return frequency;
-
+    rssiDisplayValue = (scanRssi - 140) / 10;    // Roughly 2 - 46
+    updateScannerScreen(100 - ((FREQUENCY_MAX - scanFrequency) / 3), rssiDisplayValue );
+  }
   // Fine tuning
-  scanFrequency = bestFrequency - 20;
-  bestRssi = 0;
+  scanFrequency = scanFrequency - 20;
   for (i = 0; i < 20; i++, scanFrequency += 2) {
     setRTC6715Frequency(scanFrequency);
     delay( RSSI_STABILITY_DELAY_MS );
@@ -352,7 +346,6 @@
       bestFrequency = scanFrequency;
     }
   }
-
   // Return the best frequency
   setRTC6715Frequency(bestFrequency);
   return (bestFrequency);
@@ -706,36 +699,43 @@
 //******************************************************************************
 void drawScannerScreen( void ) {
   display.clearDisplay();
-  display.drawLine(0, 56, 127, 56, WHITE);
-  display.drawLine(101, 0, 101, 55, WHITE);
+  display.drawLine(0, 55, 127, 55, WHITE);
   updateScannerScreen(0, 0);
 }

 //******************************************************************************
 //* function: updateScannerScreen
 //*         : position = 0 to 99
-//*         : value = 0 to 55
+//*         : value = 0 to 53
 //******************************************************************************
 void updateScannerScreen(uint8_t position, uint8_t value ) {
-  static uint8_t errase_position = 0;
-  static uint8_t errase_value = 0;
+  uint8_t i;
+  static uint8_t errase_position = 14;
+  static uint8_t errase_value = 53;
+  position = position + 14;
   display.drawLine( errase_position, 0, errase_position, errase_value, BLACK );
-  display.fillRect(0, 57, 128, 7, BLACK);
+  display.drawLine( errase_position, errase_value + 1, errase_position, 53, WHITE );
+  display.fillRect(0, 56, 128, 8, BLACK);
   display.setTextColor(WHITE);
   display.setTextSize(1);
-  display.setCursor(0, 55);
-  display.print("5.645   5.800   5.945");
-  display.drawLine( position,      0, position,     63, WHITE );
+  display.setCursor(0, 57);
+  display.print("5.65     5.8     5.95");
+  for ( i = 0; i < 12; i++) {
+    display.drawLine( position, i * 4, position, i * 4 + 1, WHITE );
+    display.drawLine( position, i * 4 + 2, position, i * 4 + 3,  BLACK );
+  }
+  display.drawLine( position    , 55, position    , 63, WHITE );
   display.drawLine( position - 1, 58, position - 1, 63, WHITE );
   display.drawLine( position + 1, 58, position + 1, 63, WHITE );
   display.drawLine( position - 2, 60, position - 2, 63, WHITE );
   display.drawLine( position + 2, 60, position + 2, 63, WHITE );
   display.drawLine( position - 3, 62, position - 3, 63, WHITE );
   display.drawLine( position + 3, 62, position + 3, 63, WHITE );
+
   errase_position = position;
-  if (value > 55)
-    value = 55;
-  errase_value = 55 - value;
+  if (value > 53)
+    value = 53;
+  errase_value = 53 - value;
   display.display();
 }


Create init function

Create init function

--- examples/CycleThroughColors/CycleThroughColors.ino
+++ examples/CycleThroughColors/CycleThroughColors.ino
@@ -13,6 +13,7 @@

 void setup()
 {
+  leds.init();
 }

 float hue = 0.0;


Update Monitor.ino example

Update Monitor.ino example

Reduce the CPU load precision to one decimal place so the Load numbers don't give the wrong impression about accuracy.

--- build/shared/examples/MultiTasking/Monitor/Monitor.ino
+++ build/shared/examples/MultiTasking/Monitor/Monitor.ino
@@ -1,4 +1,4 @@
-#include "Energia.h"
+#include <Energia.h>

 #include <xdc/std.h>

@@ -28,13 +28,14 @@
 #define WM_CMD 1     /* write to memory cmd */
 #define DRW_CMDS 1   /* digital read/write cmds */
 #define ARW_CMDS 1   /* analog read/write cmds */
-#define SPI_CMD 0    /* SPI transfer cmd */
+#define SPI_CMD 1    /* SPI transfer cmd */
 #define PRI_CMD 1    /* Set Task priority cmd */
 #define STATS_CMD 1  /* CPU and task utilzation stats cmd */

 #define MAX_COMMAND_LEN 48
 #define MAX_COMMAND_NAME_LEN 8
 #define MAX_COMMAND_LINES 5
+

 // Return codes for handlers
 #define RETURN_SUCCESS          (0)
@@ -663,6 +664,7 @@
     Load_Stat loadStat;
     String name;
     static char buf[100];
+    uint32_t loadInt, loadFrac;

     Task_stat(task, &taskStat);
     Load_getTaskLoad(task, &loadStat);
@@ -677,10 +679,16 @@
         }
     }

+    /* only show 1 decimal place of precision */
+    /* System_snprintf() does not support %2.1f */
+    loadInt = 100.0*(float)loadStat.threadTime/(float)loadStat.totalTime;
+    loadFrac = 1000.0*(float)loadStat.threadTime/(float)loadStat.totalTime - 10.0*loadInt;
+
+    /* use System_snprintf() because it uses 500 fewer bytes of stack than snprintf() */
     System_snprintf(buf, sizeof(buf),
-          " task: %s/0x%x, pri: %d, stack usage: %d/%d, mode: %s load: %f",
+          " task: %s/0x%x, pri: %d, stack usage: %d/%d, mode: %s load: %d.%1u",
           name, task, taskStat.priority, taskStat.used, taskStat.stackSize, getModeStr(taskStat.mode),
-          100.0*(float)loadStat.threadTime/(float)loadStat.totalTime);
+          loadInt, loadFrac);
     Serial.println(buf);
 }

@@ -689,10 +697,24 @@
     UInt i;
     Memory_Stats memStat;
     Hwi_StackInfo hwiStackStat;
+    Load_Stat loadStat;
     Task_Handle tsk;
-
+    float idleLoad;
+    uint32_t idleLoadInt, idleLoadFrac;
+
+    /* collect current stats */
+    Load_update();
+
+    /* use time NOT spent in idle task for Total CPU Load */
+    Load_getTaskLoad(Task_getIdleTask(), &loadStat);
+    idleLoad = 100.0 - 100.0*(float)loadStat.threadTime/(float)loadStat.totalTime;
+    idleLoadInt = idleLoad;
+    idleLoadFrac = 10.0*idleLoad - 10.0*idleLoadInt;
+
     Serial.write("Total CPU Load: ");
-    Serial.println(Load_getCPULoad());
+    Serial.print(idleLoadInt);
+    Serial.print(".");
+    Serial.println(idleLoadFrac);
     Serial.println("");

     /* collect stats on all statically Created tasks */


Change the storage type of the pixels to 8-bit values rather than 32-bit values

--- projects/arduino/led_matrix_256/led_matrix_256.ino
+++ projects/arduino/led_matrix_256/led_matrix_256.ino
@@ -4,14 +4,14 @@
 #include "IRremote.h"  //Remote control library
 #endif

-#define PIN 4
+#define NUM_OF_PIXELS    256
+#define MATRIX_DATA_PIN  4
+#define RECEIVER_PIN     12

-int receiver = 12; // Signal Pin of IR receiver to Arduino Digital Pin 12
-
-IRrecv irrecv(receiver);    // create instance of 'irrecv'
+IRrecv irrecv(RECEIVER_PIN);    // create instance of 'irrecv'
 decode_results results;     // create instance of 'decode_results'

-Adafruit_NeoPixel strip = Adafruit_NeoPixel(256, PIN, NEO_GRB + NEO_KHZ800);
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_OF_PIXELS, MATRIX_DATA_PIN, NEO_GRB + NEO_KHZ800);

 //int sensorPin = A5;    // select the input pin for the potentiometer
 //int sensorValue = 0;  // variable to store the value coming from the sensor
@@ -19,28 +19,21 @@
 int frame;
 int j;
 uint32_t i;
-uint32_t d=0;
-uint32_t b=pow(2,7);
-uint32_t g=pow(2,15);
-uint32_t r=pow(2,23);
-uint32_t p=b+r;
-uint32_t y=g+r;
-uint32_t a=b+g;
-uint32_t w=b+g+r;
+uint8_t d = 0;
+uint8_t b = pow(2,7);
+uint8_t g = pow(2,15);
+uint8_t r = pow(2,23);
+uint8_t p = b+r;
+uint8_t y = g+r;
+uint8_t a = b+g;
+uint8_t w = b+g+r;

 void setup() {
-    // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
-#if defined (__AVR_ATtiny85__)
-    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
-#endif
-    // End of trinket special code
-
     irrecv.enableIRIn(); // Start the remote control receiver

     Serial.begin(9600); // setup serial printing so you can troubleshoot
-    //Serial.print("i=");  //Print something to serial terminal for viewing
-    //Serial.print(i);
+
     strip.begin();
     strip.show(); // Initialize all pixels to 'off'

@@ -73,7 +66,7 @@
 //Frame 1
     if (frame==1) {

-        uint32_t myMatrixRow1[256] = {d,d,w,w,d,d,d,d,d,d,d,d,d,d,d,d,
+        uint8_t myMatrixRow1[256]  = {d,d,w,w,d,d,d,d,d,d,d,d,d,d,d,d,
                                       d,d,d,d,d,d,d,d,d,d,d,w,d,w,d,d,
                                       d,d,d,w,d,w,d,d,d,d,d,d,d,d,d,d,
                                       d,d,d,d,d,d,d,d,d,w,d,d,d,d,d,d,
@@ -104,7 +97,7 @@
 //Frame 2
     else if (frame==2) {

-        uint32_t myMatrixRow2[256] = {d,d,d,d,d,d,d,d,r,d,d,d,d,d,d,d,
+        uint8_t myMatrixRow2[256] = {d,d,d,d,d,d,d,d,r,d,d,d,d,d,d,d,
                                       d,d,d,d,d,d,d,r,d,d,d,d,d,d,d,d,
                                       d,d,d,d,d,d,d,r,w,r,d,d,d,d,d,d,
                                       d,d,d,d,d,r,r,w,r,r,d,d,d,d,d,d,
@@ -135,7 +128,7 @@
 //Frame 3
     else if (frame==3) {

-        uint32_t myMatrixRow3[256] = {d,d,d,d,d,d,d,g,g,d,d,d,d,d,d,d,
+        uint8_t myMatrixRow3[256] = {d,d,d,d,d,d,d,g,g,d,d,d,d,d,d,d,
                                       d,d,d,d,d,d,d,g,g,d,d,d,d,d,d,d,
                                       d,d,d,d,d,d,b,g,g,g,d,d,d,d,d,d,
                                       d,d,d,d,d,d,g,g,b,r,d,d,d,d,d,d,


examples: update FirebaseDemo to use getFloat

--- examples/FirebaseDemo_ESP8266/FirebaseDemo_ESP8266.ino
+++ examples/FirebaseDemo_ESP8266/FirebaseDemo_ESP8266.ino
@@ -56,7 +56,7 @@

   // get value
   Serial.print("number: ");
-  Serial.println((float)Firebase.get("number"));
+  Serial.println(Firebase.getFloat("number"));
   delay(1000);

   // remove value


adds test of setCaptivePortalEnable to example

--- examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
+++ examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
@@ -42,7 +42,8 @@
     //WITHOUT THIS THE AP DOES NOT SEEM TO WORK PROPERLY WITH SDK 1.5 , update to at least 1.5.1
     //WiFi.mode(WIFI_STA);

-    wifiManager.setCaptivePortalEnable(false);
+    // disable captibe portal redirection
+    // wifiManager.setCaptivePortalEnable(false);

     if (!wifiManager.startConfigPortal("OnDemandAP")) {
       Serial.println("failed to connect and hit timeout");


Add display execution time to scroll text test.

--- examples/Canvas/CosaCanvasST7735R/CosaCanvasST7735R.ino
+++ examples/Canvas/CosaCanvasST7735R/CosaCanvasST7735R.ino
@@ -113,6 +113,7 @@
   cout.print(&tft, 200, 16, tft.get_orientation() == Canvas::PORTRAIT ? 4 : 6);
   tft.set_text_mode(0);
   ms = (micros() - start) / 1000L;
+  cout.printf_P(PSTR("%ul ms"), ms);
   INFO("test#3:scroll text mode: %ul ms", ms);
   SLEEP(2);


- correct pins, remove ATmega32U4 specific wait for serial

--- examples/ir_bridge/ir_bridge.ino
+++ examples/ir_bridge/ir_bridge.ino
@@ -7,8 +7,8 @@

 // define pins (varies per shield/board)
 #define BLE_REQ     10
-#define BLE_RDY     9
-#define BLE_RST     2
+#define BLE_RDY     2
+#define BLE_RST     9

 #define IR_SEND_PIN 3
 #define IR_RECV_PIN 4
@@ -38,9 +38,6 @@

 void setup() {
   Serial.begin(115200);
-#ifdef __AVR_ATmega32U4__
-//  while(!Serial);
-#endif

   // set advertised local name and service UUID
   blePeripheral.setLocalName("IR");


cleaned up code and made beginnings of alarm system

--- firmware/interlock/interlock.ino
+++ firmware/interlock/interlock.ino
@@ -6,11 +6,17 @@

 #define TEMPERATURE_PRECISION 9

+#define TEMP_UPPER_RANGE 28.5
+#define TEMP_LOWER_RANGE 10.0
+
 DeviceAddress inflowTemp 	= {0x28, 0xFF, 0x6C, 0xF3, 0x64, 0x15, 0x2, 0x15};
 DeviceAddress outflowTemp  	= {0x28, 0xFF, 0xD2, 0xE1, 0x64, 0x15, 0x2, 0xC7};
 DeviceAddress tankTemp		= {0x28, 0xFF, 0xDB, 0x8D, 0x64, 0x15, 0x2, 0xB6};

+float temperatures[3];
+
 #define FLOW_RATE_MEASURE_INTERVAL 1000.0
+#define FLOW_RATE_LOWER 1.2

 byte flowInterrupt = 0; // digital 2
 byte flowPin = 2; //
@@ -52,11 +58,47 @@
     if ((millis() - flowOldTime) > FLOW_RATE_MEASURE_INTERVAL) {
         calculate_flow_rate();

-		temps.requestTemperatures();
-		Serial.print("Out ");
-		printTemperature(outflowTemp);
+        update_temperatures();
+
+        Serial.print("In ");
+		Serial.print(temperatures[0]);
+        Serial.print(" Out ");
+        Serial.print(temperatures[1]);
+        Serial.print(" Tank ");
+        Serial.print(temperatures[2]);
 		Serial.println();
     }
+
+    // now we do warning checks.
+    alarm_checks();
+
+    // TODO switch relay based on alarm.
+}
+
+
+bool alarm_checks() {
+
+    // test flow rate to see if too low
+    bool flowAlarm = false;
+    if (flowRate < FLOW_RATE_LOWER) {
+        flowAlarm = true;
+    }
+
+    // test all three temps and make sure they are in healthy range
+    bool tempAlarm = false;
+    for (uint8_t i=0; i < 3; i++) {
+        if (temperatures[i] > TEMP_UPPER_RANGE || temperatures[i] < TEMP_LOWER_RANGE) {
+            tempAlarm = true;
+        }
+    }
+
+    if (flowAlarm || tempAlarm) {
+        return (true);
+    } else {
+        return(false);
+    }
+
+    return(true);
 }

 void calculate_flow_rate() {
@@ -84,21 +126,21 @@
     attachInterrupt(flowInterrupt, pulseCounter, FALLING);
 }

+void update_temperatures() {
+    // updates the temperature values;
+	temps.requestTemperatures();
+    temperatures[0] = temps.getTempC(inflowTemp);
+    temperatures[1] = temps.getTempC(outflowTemp);
+    temperatures[2] = temps.getTempC(tankTemp);
+}
+
 /** ISR for pulsecounter **/
 void pulseCounter() {
     // just increment, don't do anything else.
     pulseCount++;
 }

-void printAddress(DeviceAddress deviceAddress)
-{
-  for (uint8_t i = 0; i < 8; i++)
-  {
-    // zero pad the address if necessary
-    if (deviceAddress[i] < 16) Serial.print("0");
-    Serial.print(deviceAddress[i], HEX);
-  }
-}
+

 void printTemperature(DeviceAddress deviceAddress)
 {


add potentiometer library and initial useage

--- NeoPixelSwitchBox/NeoPixelSwitchBox.ino
+++ NeoPixelSwitchBox/NeoPixelSwitchBox.ino
@@ -1,3 +1,5 @@
+#include <Potentiometer.h>
+
 #include <Switch.h>

 // have to include libraries referenced within libraries in the sketch as well!
@@ -15,6 +17,11 @@

 //button on pin 0, debounce 30 ms
 Switch randomButton(0, 30);
+
+// test pot
+Potentiometer pot(A0);
+
+

 /*
   initialize the ring
@@ -59,7 +66,7 @@
   //delay(1000);
   //ring.randomize();
   // first, update all inputs - switches, knobs, etc -
-  // updateComponents();
+  updateComponents();

   // Finally, update the ring itself, which should now have all current state, and will be able to determine if it needs to refresh
   ring.update();
@@ -67,6 +74,10 @@
 }

 void updateComponents() {
+  pot.update();
+  if (pot.valChangedThisUpdate()) {
+    Serial.print("pot changed to: "); Serial.println(pot.getPercentVal());
+  }
   // update spin pot - ideally have a library for this, like switch - which tells me if it's changed in a meaningful way - if it has, call spin()
   // update light knobs
   // update blink and brightness sliders


Updating example sketch to reflect changes that were done on the master branch.

--- examples/07-Bluetooth/01-BasicGain_wApp_BLE/01-BasicGain_wApp_BLE.ino
+++ examples/07-Bluetooth/01-BasicGain_wApp_BLE/01-BasicGain_wApp_BLE.ino
@@ -89,10 +89,12 @@
     case 'k':
       changeGain(3.0);
       printGainLevels();
+      setButtonText("gainIndicator", String(digital_gain_dB));
       break;
     case 'K':
       changeGain(-3.0);
       printGainLevels();
+      setButtonText("gainIndicator", String(digital_gain_dB));
       break;
   }
 }
@@ -113,18 +115,20 @@

   //Add first page to GUI
   page_h = myGUI.addPage("MyFirstPage");
+      //Add a card under the first page
       card_h = page_h->addCard("Change Loudness");
-        #if 0
-          card_h->addButton("-","K");   //assumes default ID and default width.
-          card_h->addButton("+","k");   //assumes default ID and default width
-        #else
-          card_h->addButton("-","K","minusButton",6);  //displayed string, command, button ID, button width (out of 12)
-          card_h->addButton("+","k","plusButton",6);   //displayed string, command, button ID, button width (out of 12)
-        #endif
+          //Add a "-" digital gain button with the Label("-"); Command("K"); Internal ID ("minusButton"); and width (4)
+          card_h->addButton("-","K","minusButton",4);  //displayed string, command, button ID, button width (out of 12)
+
+          //Add an indicator that's a button with no command:  Label (value of the digital gain); Command (""); Internal ID ("gain indicator"); width (4).
+          card_h->addButton(String(digital_gain_dB),"","gainIndicator",4);  //displayed string (blank), command (blank), button ID, button width (out of 12)
+
+          //Add a "+" digital gain button with the Label("+"); Command("K"); Internal ID ("minusButton"); and width (4)
+          card_h->addButton("+","k","plusButton",4);   //displayed string, command, button ID, button width (out of 12)

   //add some pre-defined pages to the GUI
   myGUI.addPredefinedPage("serialMonitor");
-  myGUI.addPredefinedPage("plot");
+  myGUI.addPredefinedPage("serialPlotter");
 }

@@ -142,4 +146,8 @@
   myTympan.println(input_gain_dB); //print text to Serial port for debugging
   myTympan.print("Digital Gain (dB) = ");
   myTympan.println(digital_gain_dB); //print text to Serial port for debugging
+void setButtonText(String btnId, String text) {
+  myTympan.println("TEXT=BTN:" + btnId + ":"+text);
 }
+
+}


use same config layout for ethernet and serial versions

--- sketches/Energino/Energino.ino
+++ sketches/Energino/Energino.ino
@@ -58,7 +58,7 @@
 //#define DEBUG

 // comment/uncomment to disable/enable ethernet support
-//#define NOETH
+#define NOETH

 #define RELAY_PIN 2

@@ -77,7 +77,7 @@
 int R1 = 100;
 int R2 = 10;
 int OFFSET = 2500;
-int SENSITIVITY = 850;
+int SENSITIVITY = 185;
 int PERIOD = 2000;

 // Control loop paramters
@@ -122,13 +122,11 @@
   int r2;
   int offset;
   int sensitivity;
-#ifndef NOETH
   byte mac[6];
   char apikey[49];
   long feed;
   IPAddress host;
   long port;
-#endif
 }
 settings;

@@ -170,10 +168,12 @@
   resetSleep(settings.period);
 #ifndef NOETH
   // Try to configure the ethernet using DHCP
+  Serial.println("@dhcp");
   if (Ethernet.begin(settings.mac) == 0) {
     Serial.println("@dhcp: fail");
     return;
   }
+  Serial.println("@dhcp done");
   // Start server
   server.begin();
   // Init SD


setup for Single testing for Carrino

setup for Single testing for Carrino

--- Fast_LEDs_combo_w__Accel_code/Fast_LEDs_combo_w__Accel_code.ino
+++ Fast_LEDs_combo_w__Accel_code/Fast_LEDs_combo_w__Accel_code.ino
@@ -10,17 +10,18 @@
 Accel accel(ACCEL_INTERVAL_MS);
 Phase phase(PHASE_INTERVAL_MS);
 #if FASTLED_VERSION < 3001000
+
 #error "Requires FastLED 3.1 or later; check github for latest code."
 #endif

-#define DATA_PIN    6
+#define DATA_PIN    8
 //#define CLK_PIN   4
 #define LED_TYPE    WS2811
 #define COLOR_ORDER GRB
-#define NUM_LEDS    36
+#define NUM_LEDS    1
 CRGB leds[NUM_LEDS];

-#define BRIGHTNESS          96
+#define BRIGHTNESS          127
 #define FRAMES_PER_SECOND  120
 bool DirectionalThreshold;  //whether the compass threshold can be used
 bool Dance;                 //whether accelerometer is dancing hard enought to be used
@@ -35,6 +36,8 @@
      // tell FastLED about the LED strip configuration
   FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
   //FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
+
+    FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);

   // set master brightness control
   FastLED.setBrightness(BRIGHTNESS);
@@ -117,7 +120,8 @@
 void rainbow()
 {
   // FastLED's built-in rainbow generator
-  fill_rainbow( leds, NUM_LEDS, gHue, 7);
+  //fill_rainbow( leds, NUM_LEDS, gHue, 7);
+  fill_gradient( leds, NUM_LEDS, CHSV (gHue,255,127), CHSV(gHue + 128,255,127));
 }

 void rainbowWithGlitter()
@@ -146,7 +150,8 @@
 {
   // a colored dot sweeping back and forth, with fading trails
   fadeToBlackBy( leds, NUM_LEDS, 10);
-  int pos = beatsin16(13,0,NUM_LEDS);
+    int pos = beatsin16(7,0,NUM_LEDS);
+    //int pos = beat16(13);
   leds[pos] += CHSV( gHue, 255, 192);
 }

@@ -162,12 +167,16 @@
 }

 void juggle() {
-  // eight colored dots, weaving in and out of sync with each other
-  fadeToBlackBy( leds, NUM_LEDS, 20);
-  byte dothue = 0;
-  for( int i = 0; i < 8; i++) {
-    leds[beatsin16(i+7,0,NUM_LEDS)] |= CHSV(dothue, 200, 255);
-    dothue += 32;
+//  // eight colored dots, weaving in and out of sync with each other
+//  fadeToBlackBy( leds, NUM_LEDS, 20);
+//  byte dothue = 0;
+//  for( int i = 0; i < 8; i++) {
+//    leds[beatsin16(i+7,0,NUM_LEDS)] |= CHSV(dothue, 200, 255);
+//    dothue += 32;
+//  }
+  for (int i = 0; i < NUM_LEDS; i++)
+  {
+    leds[i] = CHSV (gHue, 255,127);
   }
 }


Add error handling of invalid request

Add error handling of invalid request

--- minirum/minirum.ino
+++ minirum/minirum.ino
@@ -26,18 +26,24 @@
     if (root != NULL) {
       aJsonObject* freq = aJson.getObjectItem(root, "freq");
       aJsonObject* data = aJson.getObjectItem(root, "data");
-      const int d_size = aJson.getArraySize(data);
-      unsigned int rawData[d_size];
-      for (int i = 0; i < d_size; i++) {
-        aJsonObject* d_int = aJson.getArrayItem(data, i);
-        rawData[i] = d_int->valueint;
+      if (freq != NULL && data != NULL) {
+        const int d_size = aJson.getArraySize(data);
+        unsigned int rawData[d_size];
+        for (int i = 0; i < d_size; i++) {
+          aJsonObject* d_int = aJson.getArrayItem(data, i);
+          rawData[i] = d_int->valueint;
+        }
+        irsend.sendRaw(rawData, d_size, freq->valueint);
+        irrecv.enableIRIn();
+        req = "";
+        aJson.deleteItem(root);
+        webServer.send(200, "text/plain", "ok");
+      } else {
+        webServer.send(400, "text/plain", "Invalid JSON format");
       }
-      irsend.sendRaw(rawData, d_size, freq->valueint);
-      irrecv.enableIRIn();
-      req = "";
-      aJson.deleteItem(root);
+    } else {
+      webServer.send(400, "text/plain", "Request body is empty");
     }
-    webServer.send(200, "text/plain", "ok");
   }
   else if (webServer.method() == HTTP_GET) {
     String s = "{\"format\":\"raw\",\"freq\":38,\"data\":[";


publish sw state every 5sec

publish sw state every 5sec

--- _70-homekit-accessories-light/_70-homekit-accessories-light.ino
+++ _70-homekit-accessories-light/_70-homekit-accessories-light.ino
@@ -18,6 +18,7 @@
 #define LED_PIN 13

 #define BETWEEN_RELAY_ACTIVE 1000
+#define REPORT_INTERVAL 5000 // in msec

 IPAddress mqtt_server = MQTT_SERVER;

@@ -30,6 +31,7 @@
 volatile bool bRelayReady = false;
 String clientName;
 unsigned long lastRelayActionmillis;
+unsigned long startMills;

 void ICACHE_RAM_ATTR callback(char* intopic, byte* inpayload, unsigned int length);

@@ -286,7 +288,7 @@
   pinMode(RELAY_PIN, OUTPUT);
   pinMode(BUTTON_PIN, INPUT_PULLUP);

-  lastRelayActionmillis = millis();
+  startMills = lastRelayActionmillis = millis();

   attachInterrupt(BUTTON_PIN, run_lightcmd_isr, RISING);

@@ -325,7 +327,10 @@
     if (bRelayReady)
     {
       change_light();
-      sendCheck();
+      if (client.connected())
+      {
+         sendCheck();
+      }
       lastRelayActionmillis = millis();
       bUpdated = false;
     }
@@ -351,6 +356,11 @@
     }
     else
     {
+      if (millis() - startMills > REPORT_INTERVAL)
+      {
+         sendCheck();
+         startMills = millis();
+      }
       client.loop();
     }
     ArduinoOTA.handle();


Remove debug code from release mode.

Remove debug code from release mode.

--- FoxkehRobo/misc/arduino/FoxkehRobo/FoxkehRobo.ino
+++ FoxkehRobo/misc/arduino/FoxkehRobo/FoxkehRobo.ino
@@ -94,6 +94,8 @@
 void loop()
 {
   // データ受信
+  //if (Serial.available() > 0) {
+  // for (int i=0;i<2 && Serial.available() > 0;i++) {
   while(Serial.available() > 0) {
     unsigned char c = Serial.read();
 #ifdef DUMP_RAW
@@ -139,7 +141,7 @@
     }
     SoftwareServo::refresh();
   }
-  delay(10);
+  delay(5);
 }

 void handleRecvPacket(unsigned char packetType, unsigned char opCode, int dataLen, unsigned char* data) {
@@ -182,11 +184,13 @@
       } else {
         for (int i=0;i<SERVO_NUM;i++) {
           myServos[i].value = data[i];
+#ifdef DUMP_PACKET
           gDebug.print("Servo idx=");
           gDebug.print(i, DEC);
           gDebug.print(", value=");
           gDebug.print(myServos[i].value, HEX);
           gDebug.print("\n");
+#endif
         }
       }
 //    } else if (opCode == 2) {
@@ -204,11 +208,13 @@
         for (int i=0;i<SERVO_NUM;i++) {
           if (flags & (1<<i)) {
             myServos[i].value = data[i+2];
+#ifdef DUMP_PACKET
             gDebug.print("Servo idx=");
             gDebug.print(i, DEC);
             gDebug.print(", value=");
             gDebug.print(myServos[i].value, HEX);
             gDebug.print("\n");
+#endif
           }
         }
 //        if (flags & (1<<SERVO_NUM)) {


found the remaining int... changed to float

--- arduino/car_control/src/main_control_nano/main_control_nano.ino
+++ arduino/car_control/src/main_control_nano/main_control_nano.ino
@@ -85,7 +85,7 @@
 bool emergency_breaking = false;

 //sets the steering angle between -45, 45 for full left /right respectively. set to zero for straight ahead
-void set_steer_angle(int angle) {
+void set_steer_angle(float angle) {
   steering_angle = angle;
   commander.sendBinCmd(cmd_steer,steering_angle);