Skip to content

Commit

Permalink
ifan: refactor into a separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Jan 14, 2021
1 parent 8ceeebd commit a40eca3
Show file tree
Hide file tree
Showing 10 changed files with 402 additions and 78 deletions.
9 changes: 9 additions & 0 deletions code/espurna/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,7 @@
//--------------------------------------------------------------------------------
// TUYA switch & dimmer support
//--------------------------------------------------------------------------------

#ifndef TUYA_SUPPORT
#define TUYA_SUPPORT 0
#endif
Expand Down Expand Up @@ -1837,6 +1838,14 @@
#define PROMETHEUS_SUPPORT 0
#endif

//--------------------------------------------------------------------------------
// ITEAD iFan support
//--------------------------------------------------------------------------------

#ifndef IFAN_SUPPORT
#define IFAN_SUPPORT 0
#endif

// =============================================================================
// Configuration helpers
// =============================================================================
Expand Down
18 changes: 5 additions & 13 deletions code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -1010,25 +1010,17 @@
#define MANUFACTURER "ITEAD"
#define DEVICE "SONOFF_IFAN02"

// These are virtual buttons triggered by the remote
// Base module
#define IFAN_SUPPORT 1

// These buttons are triggered by the remote
#define BUTTON1_PIN 0
#define BUTTON2_PIN 9
#define BUTTON3_PIN 10
#define BUTTON4_PIN 14
#define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON4_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH

// Relays
// Only one relay by default, controlling the ON / OFF
#define RELAY1_PIN 12
#define RELAY2_PIN 5
#define RELAY3_PIN 4
#define RELAY4_PIN 15
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_TYPE RELAY_TYPE_NORMAL
#define RELAY3_TYPE RELAY_TYPE_NORMAL
#define RELAY4_TYPE RELAY_TYPE_NORMAL

// LEDs
#define LED1_PIN 13
Expand Down
Loading

0 comments on commit a40eca3

Please sign in to comment.