Browse Source

Add dim up and down actions to button handler (#1250)

sensors
Xose Pérez 5 years ago
parent
commit
628968cafa
15 changed files with 13647 additions and 13607 deletions
  1. +36
    -12
      code/espurna/button.ino
  2. +3
    -0
      code/espurna/config/types.h
  3. BIN
      code/espurna/data/index.all.html.gz
  4. BIN
      code/espurna/data/index.light.html.gz
  5. BIN
      code/espurna/data/index.rfbridge.html.gz
  6. BIN
      code/espurna/data/index.rfm69.html.gz
  7. BIN
      code/espurna/data/index.sensor.html.gz
  8. BIN
      code/espurna/data/index.small.html.gz
  9. +1
    -1
      code/espurna/encoder.ino
  10. +2384
    -2382
      code/espurna/static/index.all.html.gz.h
  11. +2223
    -2221
      code/espurna/static/index.light.html.gz.h
  12. +1920
    -1918
      code/espurna/static/index.rfbridge.html.gz.h
  13. +3224
    -3222
      code/espurna/static/index.rfm69.html.gz.h
  14. +1980
    -1977
      code/espurna/static/index.sensor.html.gz.h
  15. +1876
    -1874
      code/espurna/static/index.small.html.gz.h

+ 36
- 12
code/espurna/button.ino View File

@ -105,37 +105,61 @@ void buttonEvent(unsigned int id, unsigned char event) {
}
#endif
if (action == BUTTON_MODE_TOGGLE) {
if (BUTTON_MODE_TOGGLE == action) {
if (_buttons[id].relayID > 0) {
relayToggle(_buttons[id].relayID - 1);
}
}
if (action == BUTTON_MODE_ON) {
if (BUTTON_MODE_ON == action) {
if (_buttons[id].relayID > 0) {
relayStatus(_buttons[id].relayID - 1, true);
}
}
if (action == BUTTON_MODE_OFF) {
if (BUTTON_MODE_OFF == action) {
if (_buttons[id].relayID > 0) {
relayStatus(_buttons[id].relayID - 1, false);
}
}
if (action == BUTTON_MODE_AP) wifiStartAP();
#if defined(JUSTWIFI_ENABLE_WPS)
if (action == BUTTON_MODE_WPS) wifiStartWPS();
#endif // defined(JUSTWIFI_ENABLE_WPS)
#if defined(JUSTWIFI_ENABLE_SMARTCONFIG)
if (action == BUTTON_MODE_SMART_CONFIG) wifiStartSmartConfig();
#endif // defined(JUSTWIFI_ENABLE_SMARTCONFIG)
if (action == BUTTON_MODE_RESET) {
if (BUTTON_MODE_AP == action) {
wifiStartAP();
}
if (BUTTON_MODE_RESET == action) {
deferredReset(100, CUSTOM_RESET_HARDWARE);
}
if (action == BUTTON_MODE_FACTORY) {
if (BUTTON_MODE_FACTORY == action) {
DEBUG_MSG_P(PSTR("\n\nFACTORY RESET\n\n"));
resetSettings();
deferredReset(100, CUSTOM_RESET_FACTORY);
}
#if defined(JUSTWIFI_ENABLE_WPS)
if (BUTTON_MODE_WPS == action) {
wifiStartWPS();
}
#endif // defined(JUSTWIFI_ENABLE_WPS)
#if defined(JUSTWIFI_ENABLE_SMARTCONFIG)
if (BUTTON_MODE_SMART_CONFIG == action) {
wifiStartSmartConfig();
}
#endif // defined(JUSTWIFI_ENABLE_SMARTCONFIG)
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
if (BUTTON_MODE_DIM_UP == action) {
lightBrightnessStep(1);
lightUpdate(true, true);
}
if (BUTTON_MODE_DIM_DOWN == action) {
lightBrightnessStep(-1);
lightUpdate(true, true);
}
#endif // LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
}
void buttonSetup() {


+ 3
- 0
code/espurna/config/types.h View File

@ -48,6 +48,9 @@
#define BUTTON_MODE_FACTORY 7
#define BUTTON_MODE_WPS 8
#define BUTTON_MODE_SMART_CONFIG 9
#define BUTTON_MODE_DIM_UP 10
#define BUTTON_MODE_DIM_DOWN 11
// Needed for ESP8285 boards under Windows using PlatformIO (?)
#ifndef BUTTON_PUSHBUTTON


BIN
code/espurna/data/index.all.html.gz View File


BIN
code/espurna/data/index.light.html.gz View File


BIN
code/espurna/data/index.rfbridge.html.gz View File


BIN
code/espurna/data/index.rfm69.html.gz View File


BIN
code/espurna/data/index.sensor.html.gz View File


BIN
code/espurna/data/index.small.html.gz View File


+ 1
- 1
code/espurna/encoder.ino View File

@ -105,7 +105,7 @@ void _encoderLoop() {
// action
if (encoder.button_pin == GPIO_NONE) {
// if there is no button, the encoder driver the CHANNEL1
// if there is no button, the encoder drives CHANNEL1
lightChannelStep(encoder.channel1, delta);
} else {


+ 2384
- 2382
code/espurna/static/index.all.html.gz.h
File diff suppressed because it is too large
View File


+ 2223
- 2221
code/espurna/static/index.light.html.gz.h
File diff suppressed because it is too large
View File


+ 1920
- 1918
code/espurna/static/index.rfbridge.html.gz.h
File diff suppressed because it is too large
View File


+ 3224
- 3222
code/espurna/static/index.rfm69.html.gz.h
File diff suppressed because it is too large
View File


+ 1980
- 1977
code/espurna/static/index.sensor.html.gz.h
File diff suppressed because it is too large
View File


+ 1876
- 1874
code/espurna/static/index.small.html.gz.h
File diff suppressed because it is too large
View File


Loading…
Cancel
Save