Compare commits
No commits in common. "flurlampe" and "master" have entirely different histories.
3 changed files with 8 additions and 94 deletions
|
@ -314,7 +314,6 @@ void setup() {
|
|||
// system_update_cpu_freq(160);
|
||||
|
||||
DBG_OUTPUT_PORT.begin(115200);
|
||||
DBG_OUTPUT_PORT.println("Starting LEDs");
|
||||
EEPROM.begin(512);
|
||||
|
||||
// set builtin led pin as output
|
||||
|
@ -322,9 +321,6 @@ void setup() {
|
|||
// button pin setup
|
||||
#ifdef ENABLE_BUTTON
|
||||
pinMode(BUTTON,INPUT_PULLUP);
|
||||
#endif
|
||||
#ifdef ENABLE_SIMPLEINPUT
|
||||
pinMode(SIMPLEINPUT,INPUT);
|
||||
#endif
|
||||
// start ticker with 0.5 because we start in AP mode and try to connect
|
||||
ticker.attach(0.5, tick);
|
||||
|
@ -638,11 +634,6 @@ void setup() {
|
|||
#else
|
||||
json["button_mode"] = "OFF";
|
||||
#endif
|
||||
#ifdef ENABLE_SIMPLEINPUT
|
||||
json["simpleinput_mode"] = "ON";
|
||||
#else
|
||||
json["simpleinput_mode"] = "OFF";
|
||||
#endif
|
||||
#ifdef ENABLE_AMQTT
|
||||
json["amqtt"] = "ON";
|
||||
#endif
|
||||
|
@ -1169,9 +1160,6 @@ void loop() {
|
|||
#ifdef ENABLE_BUTTON
|
||||
button();
|
||||
#endif
|
||||
#ifdef ENABLE_SIMPLEINPUT
|
||||
simpleinput();
|
||||
#endif
|
||||
server.handleClient();
|
||||
webSocket.loop();
|
||||
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
#define USE_WS2812FX_DMA // LED_PIN is ignored & set to RX/GPIO3 Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
|
||||
//#define USE_WS2812FX_DMA // LED_PIN is ignored & set to RX/GPIO3 Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
|
||||
//#define USE_WS2812FX_UART1 // LED_PIN is ignored & set to D4/GPIO2 Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
|
||||
//#define USE_WS2812FX_UART2 // LED_PIN is ignored & set to TX/GPIO1 Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
|
||||
|
||||
// Neopixel
|
||||
#define LED_PIN 3 // LED_PIN (14 / D5) where neopixel / WS2811 strip is attached
|
||||
#define NUMLEDS 30 // Number of leds in the strip
|
||||
#define LED_PIN 14 // LED_PIN (14 / D5) where neopixel / WS2811 strip is attached
|
||||
#define NUMLEDS 24 // Number of leds in the strip
|
||||
//#define LED_TYPE_WS2811 // Uncomment if LED type uses 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
|
||||
#define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192
|
||||
//#define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.
|
||||
#define SIMPLEINPUT 5
|
||||
#define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.
|
||||
|
||||
#define HOSTNAME "motion1" // Friedly hostname
|
||||
#define HOSTNAME "McLighting01" // Friedly hostname
|
||||
|
||||
#define HTTP_OTA // If defined, enable ESP8266HTTPUpdateServer OTA code.
|
||||
//#define ENABLE_OTA // If defined, enable Arduino OTA code.
|
||||
#define ENABLE_AMQTT // If defined, enable Async MQTT code, see: https://github.com/marvinroger/async-mqtt-client
|
||||
//#define ENABLE_MQTT // If defined, enable MQTT client code, see: https://github.com/toblum/McLighting/wiki/MQTT-API
|
||||
#define ENABLE_HOMEASSISTANT // If defined, enable Homeassistant integration, ENABLE_MQTT or ENABLE_AMQTT must be active
|
||||
//#define ENABLE_BUTTON // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control
|
||||
#define ENABLE_SIMPLEINPUT // If defined, enable a simple low/high input handler
|
||||
#define ENABLE_BUTTON // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control
|
||||
//#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
|
||||
#define ENABLE_LEGACY_ANIMATIONS // Dont disbale this for now
|
||||
#define ENABLE_E131 // E1.31 implementation
|
||||
|
@ -35,8 +33,8 @@
|
|||
//#define WIFIMGR_SET_MANUAL_IP
|
||||
|
||||
#ifdef WIFIMGR_SET_MANUAL_IP
|
||||
uint8_t _ip[4] = {192,168,178,128};
|
||||
uint8_t _gw[4] = {192,168,178,1};
|
||||
uint8_t _ip[4] = {192,168,0,128};
|
||||
uint8_t _gw[4] = {192,168,0,1};
|
||||
uint8_t _sn[4] = {255,255,255,0};
|
||||
#endif
|
||||
|
||||
|
@ -178,12 +176,3 @@ LEDState main_color = { 255, 0, 0 }; // Store the "main color" of the strip use
|
|||
byte prevKeyState = HIGH; // button is active low
|
||||
boolean buttonState = false;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SIMPLEINPUT
|
||||
//#define SIMPLEINPUT_MODE_HIGH "STA| 1| 0|245|196|255|255|255"
|
||||
//#define SIMPLEINPUT_MODE_HIGH "STA| 1| 0|245|196|0|0|0"
|
||||
|
||||
const unsigned long inputSampleIntervalMs = 25;
|
||||
byte prevInputState = LOW;
|
||||
unsigned long inputPrevMillis = 0;
|
||||
#endif
|
||||
|
|
|
@ -1290,69 +1290,6 @@ void checkForRequests() {
|
|||
}
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
// Simple Input management
|
||||
// ***************************************************************************
|
||||
#ifdef ENABLE_SIMPLEINPUT
|
||||
|
||||
|
||||
// called when button is kept pressed for less than 2 seconds
|
||||
void inputHandleHigh() {
|
||||
DBG_OUTPUT_PORT.printf("Input changed to high\n");
|
||||
#ifdef SIMPLEINPUT_MODE_HIGH
|
||||
setModeByStateString(SIMPLEINPUT_MODE_HIGH);
|
||||
#endif
|
||||
#ifdef ENABLE_MQTT
|
||||
mqtt_client.publish(mqtt_outtopic, String("OK >1").c_str());
|
||||
#endif
|
||||
#ifdef ENABLE_AMQTT
|
||||
amqttClient.publish(mqtt_outtopic.c_str(), qospub, false, String("OK >1").c_str());
|
||||
#endif
|
||||
// #ifdef ENABLE_HOMEASSISTANT
|
||||
// stateOn = true;
|
||||
// if(!ha_send_data.active()) ha_send_data.once(5, tickerSendState);
|
||||
// #endif
|
||||
// #ifdef ENABLE_STATE_SAVE_SPIFFS
|
||||
// if(!spiffs_save_state.active()) spiffs_save_state.once(3, tickerSpiffsSaveState);
|
||||
// #endif
|
||||
}
|
||||
void inputHandleLow() {
|
||||
DBG_OUTPUT_PORT.printf("Input changed to low\n");
|
||||
#ifdef SIMPLEINPUT_MODE_HIGH
|
||||
setModeByStateString(SIMPLEINPUT_MODE_LOW);
|
||||
#endif
|
||||
#ifdef ENABLE_MQTT
|
||||
mqtt_client.publish(mqtt_outtopic, String("OK >0").c_str());
|
||||
#endif
|
||||
#ifdef ENABLE_AMQTT
|
||||
amqttClient.publish(mqtt_outtopic.c_str(), qospub, false, String("OK >0").c_str());
|
||||
#endif
|
||||
// #ifdef ENABLE_HOMEASSISTANT
|
||||
// stateOn = false;
|
||||
// if(!ha_send_data.active()) ha_send_data.once(5, tickerSendState);
|
||||
// #endif
|
||||
// #ifdef ENABLE_STATE_SAVE_SPIFFS
|
||||
// if(!spiffs_save_state.active()) spiffs_save_state.once(3, tickerSpiffsSaveState);
|
||||
// #endif
|
||||
}
|
||||
|
||||
void simpleinput() {
|
||||
if (millis() - inputPrevMillis >= inputSampleIntervalMs) {
|
||||
inputPrevMillis = millis();
|
||||
|
||||
byte currInputState = digitalRead(SIMPLEINPUT);
|
||||
|
||||
if ((prevInputState == HIGH) && (currInputState == LOW)) {
|
||||
inputHandleLow();
|
||||
}
|
||||
else if ((prevInputState == LOW) && (currInputState == HIGH)) {
|
||||
inputHandleHigh();
|
||||
}
|
||||
prevInputState = currInputState;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_STATE_SAVE_SPIFFS
|
||||
bool updateFS = false;
|
||||
#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)
|
||||
|
|
Loading…
Reference in a new issue