openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.71k forks source link

[serial] Fixed bug where serial commands in rapid succession were not recognized #5891

Closed marekhalmo closed 4 years ago

marekhalmo commented 4 years ago

… recognized

5889

marekhalmo commented 4 years ago

Can anyone help me fix this? I tried this but i'm probably missing something..

marekhalmo commented 4 years ago

Ok.. signed.. waiting for Jenkins

marekhalmo commented 4 years ago

All done.. Please check the code and merge.. the build jar to check is here Just add it to the addons folder and you are ready to go.

Here is the code to check the old/new functionality, the old version will not catch the ON/OFF events. The new version will. Please make sure that you set the proper COM port. This is a windows version [serial.items] Switch onOffInput "ON/OFF" { serial="COM9@115200,ON(S1),OFF(R1)" }

Arduino sketch (any USB connected Arduino will work)

// Test sketch that is simulating button clicks on serial input gateway

// State indicator
#define LED LED_BUILD_IN
#define SERIAL_RATE_BAUD 115200

void setup() {
  Serial.begin(SERIAL_RATE_BAUD);
}

void loop() {
  Serial.println("S1");
  delay(50);
  Serial.println("R1");
  Serial.println("C1");
  delay(500);

  Serial.println("S1");
  delay(50);
  Serial.println("R1");
  delay(100);
  Serial.println("S1");
  delay(50);
  Serial.println("R1");
  Serial.println("D1");

  delay(500);
  Serial.println("S1");
  delay(500);
  Serial.println("H1");
  delay(500);
  Serial.println("R1");
  Serial.println("E1");

  delay(500);
}
marekhalmo commented 4 years ago

@kaikreuzer will this be added to the next build? When will this happen? Everything is ready to go

marekhalmo commented 4 years ago

Thanks @kaikreuzer . You are the best :)