-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
353 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "apps/zigbee/z_switch/z_switch_module.h" | ||
#include "apps/zigbee/z_switch/z_switch_screens.h" | ||
#include "esp_log.h" | ||
#include "menus_module.h" | ||
|
||
static uint16_t current_item = 0; | ||
|
||
static void z_switch_module_cb_event(uint8_t button_name, uint8_t button_event); | ||
static void z_switch_module_cb_connection_handler(bool connection); | ||
|
||
static void module_reset_menu() { | ||
current_item = 0; | ||
menus_module_set_app_state(true, z_switch_module_cb_event); | ||
} | ||
|
||
static void module_increment_item() { | ||
current_item++; | ||
} | ||
|
||
static void module_decrement_item() { | ||
current_item--; | ||
} | ||
|
||
static void z_switch_module_cb_connection_handler(bool connection) {} | ||
|
||
static void z_switch_module_cb_event(uint8_t button_name, | ||
uint8_t button_event) { | ||
if (button_event != BUTTON_PRESS_DOWN) { | ||
return; | ||
} | ||
switch (button_name) { | ||
case BUTTON_UP: | ||
break; | ||
case BUTTON_DOWN: | ||
break; | ||
case BUTTON_RIGHT: | ||
break; | ||
case BUTTON_LEFT: | ||
menus_module_exit_app(); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
void z_switch_module_begin() { | ||
radio_selector_set_zigbee_switch(); | ||
zigbee_switch_set_display_status_cb(z_switch_handle_connection_status); | ||
zigbee_switch_init(); | ||
menus_module_set_app_state(true, z_switch_module_cb_event); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <stdint.h> | ||
#ifndef Z_SWITCH_MODULE_H | ||
#define Z_SWITCH_MODULE_H | ||
void z_switch_module_begin(); | ||
#endif // Z_SWITCH_MODULE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "z_switch_screens.h" | ||
#include <stdint.h> | ||
#include <string.h> | ||
#include "animations_task.h" | ||
#include "freertos/FreeRTOS.h" | ||
#include "general/bitmaps_general.h" | ||
#include "led_events.h" | ||
#include "oled_screen.h" | ||
|
||
static uint16_t hid_current_item = 0; | ||
|
||
static void z_switch_display_creating_network() { | ||
oled_screen_clear(); | ||
oled_screen_display_text_center("Creating network", 2, OLED_DISPLAY_NORMAL); | ||
} | ||
|
||
static void z_switch_display_waiting_device() { | ||
oled_screen_clear(); | ||
oled_screen_display_text_center("Waiting for devices", 2, | ||
OLED_DISPLAY_NORMAL); | ||
} | ||
|
||
void z_switch_handle_connection_status(uint8_t status) { | ||
switch (status) { | ||
case CREATING_NETWORK: | ||
z_switch_display_creating_network(); | ||
break; | ||
case CREATING_NETWORK_FAILED: | ||
break; | ||
case WAITING_FOR_DEVICES: | ||
z_switch_display_waiting_device(); | ||
break; | ||
case NO_DEVICES_FOUND: | ||
break; | ||
case CLOSING_NETWORK: | ||
break; | ||
case LIGHT_PRESSED: | ||
break; | ||
case LIGHT_RELASED: | ||
default: | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include "general/general_screens.h" | ||
#include "radio_selector.h" | ||
#include "zigbee_switch.h" | ||
#ifndef Z_SWITCH_SCREENS_H | ||
#define Z_SWITCH_SCREENS_H | ||
|
||
void z_switch_handle_connection_status(uint8_t status); | ||
#endif // Z_SWITCH_SCREENS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.