small interface improvements, renaming of device specific modules, starting with TTGO T-Wristband support

This commit is contained in:
Lurkars
2020-12-15 13:12:35 +01:00
parent 48528e027e
commit 17ebf801f1
45 changed files with 850 additions and 54 deletions
+11 -8
View File
@@ -1,15 +1,18 @@
set(priv_requires "ena" "ena-eke-proxy" "display" "rtc" "wifi-controller" )
if(CONFIG_ENA_INTERFACE_CUSTOM)
list(APPEND priv_requires "display-ssd1306" "rtc-ds3231")
elseif(ENA_INTERFACE_M5STICKC)
list(APPEND priv_requires "display-st7735s" "rtc-bm8563" "imu-mpu6886" "pmu-axp192")
elseif(ENA_INTERFACE_M5STICKC_PLUS)
list(APPEND priv_requires "display-st7789" "rtc-bm8563" "imu-mpu6886" "pmu-axp192")
list(APPEND priv_requires "display-custom-ssd1306" "rtc-custom-ds3231")
elseif(CONFIG_ENA_INTERFACE_M5STICKC)
list(CONFIG_APPEND priv_requires "display-m5-st7735s" "rtc-m5-bm8563" "imu-m5-mpu6886" "pmu-m5-axp192")
elseif(CONFIG_ENA_INTERFACE_M5STICKC_PLUS)
list(APPEND priv_requires "display-m5-st7789" "rtc-m5-bm8563" "imu-m5-mpu6886" "pmu-m5-axp192")
elseif(CONFIG_ENA_INTERFACE_TTGO_T_WRISTBAND)
list(APPEND priv_requires "display-ttgo-st7735" "imu-ttgo-lsm9ds1")
else()
list(APPEND priv_requires "display-ssd1306" "rtc-ds3231") # uncomment for custom device with SSD1306 und DS3231
# list(APPEND priv_requires "display-st7735s" "rtc-bm8563" "imu-mpu6886" "pmu-axp192") # uncomment for M5StickC
# list(APPEND priv_requires "display-st7789" "rtc-bm8563" "imu-mpu6886" "pmu-axp192") # uncomment for M5StickC PLUS
list(APPEND priv_requires "display-custom-ssd1306" "rtc-custom-ds3231") # uncomment for custom device with SSD1306 und DS3231
# list(APPEND priv_requires "display-m5-st7735s" "rtc-m5-bm8563" "imu-m5-mpu6886" "pmu-m5-axp192") # uncomment for M5StickC
# list(APPEND priv_requires "display-m5-st7789" "rtc-m5-bm8563" "imu-m5-mpu6886" "pmu-m5-axp192") # uncomment for M5StickC PLUS
# list(APPEND priv_requires "display-ttgo-st7735" "imu-ttgo-lsm9ds1") # uncomment for TTGO T-Wristband
endif()
idf_component_register(
+3
View File
@@ -21,6 +21,9 @@ menu "ENA Interface"
config ENA_INTERFACE_M5STICKC_PLUS
bool "M5StickC PLUS"
config ENA_INTERFACE_TTGO_T_WRISTBAND
bool "TTGO T-Wristband"
endchoice
endmenu
+20 -2
View File
@@ -27,6 +27,10 @@
#include "axp192.h"
#endif
#if defined(CONFIG_ENA_INTERFACE_TTGO_T_WRISTBAND)
#include "lsm9ds1.h"
#endif
#include "interface.h"
static bool runTask = true;
@@ -75,7 +79,7 @@ void interface_debug_dwn(void)
void interface_debug_task(void *pvParameter)
{
#if defined(CONFIG_ENA_INTERFACE_M5STICKC) || defined(CONFIG_ENA_INTERFACE_M5STICKC_PLUS)
#if defined(CONFIG_ENA_INTERFACE_M5STICKC) || defined(CONFIG_ENA_INTERFACE_M5STICKC_PLUS) || defined(CONFIG_ENA_INTERFACE_TTGO_T_WRISTBAND)
float ax = 0;
float ay = 0;
float az = 0;
@@ -94,6 +98,14 @@ void interface_debug_task(void *pvParameter)
mpu6886_get_accel_data(&ax, &ay, &az);
mpu6886_get_gyro_data(&gx, &gy, &gz);
#endif
#if defined(CONFIG_ENA_INTERFACE_TTGO_T_WRISTBAND)
lsm9ds1_get_accel_data(&ax, &ay, &az);
lsm9ds1_get_gyro_data(&gx, &gy, &gz);
#endif
#if defined(CONFIG_ENA_INTERFACE_M5STICKC) || defined(CONFIG_ENA_INTERFACE_M5STICKC_PLUS) || defined(CONFIG_ENA_INTERFACE_TTGO_T_WRISTBAND)
char data_chars[32];
sprintf(data_chars, "acc x:%3.2f", ax);
display_text_line(data_chars, 2, false);
@@ -108,8 +120,10 @@ void interface_debug_task(void *pvParameter)
sprintf(data_chars, "gyr z:%3.2f", gz);
display_text_line(data_chars, 7, false);
float bat_v = axp192_get_bat_voltage();
#endif
#if defined(CONFIG_ENA_INTERFACE_M5STICKC) || defined(CONFIG_ENA_INTERFACE_M5STICKC_PLUS)
float bat_v = axp192_get_bat_voltage();
sprintf(data_chars, "Battery: %.2f V", bat_v);
display_text_line(data_chars, 7, false);
@@ -123,6 +137,10 @@ void interface_debug_task(void *pvParameter)
void interface_debug_start(void)
{
#if defined(CONFIG_ENA_INTERFACE_TTGO_T_WRISTBAND)
lsm9ds1_start();
#endif
interface_register_command_callback(INTERFACE_COMMAND_RST, &interface_debug_rst);
interface_register_command_callback(INTERFACE_COMMAND_SET, &interface_debug_set);
interface_register_command_callback(INTERFACE_COMMAND_LFT, &interface_debug_lft);
+9 -9
View File
@@ -111,15 +111,10 @@ void interface_input_rht(void)
if (current_cursor > current_max_index)
{
current_max_index = current_cursor;
strcpy(current_char_set, char_set_uppercase);
current_text[current_cursor] = current_text[current_cursor - 1];
}
current_char_index = 0;
current_text[current_cursor] = current_char_set[current_char_index];
}
else
{
interface_input_set_char_set();
}
interface_input_set_char_set();
}
}
@@ -149,7 +144,12 @@ void interface_input_mid(void)
{
strcpy(current_char_set, char_set_uppercase);
}
current_char_index = 0;
if (current_char_index >= strlen(current_char_set))
{
current_char_index = 0;
}
current_text[current_cursor] = current_char_set[current_char_index];
}
+4
View File
@@ -40,7 +40,9 @@ void interface_init_label(void)
interface_text_headline_info.text[EN] = "INFO";
interface_text_headline_debug.text[EN] = "DEBUG";
interface_text_wifi_waiting.text[EN] = "Waiting...";
interface_text_wifi_scanning.text[EN] = "Scanning...";
interface_text_wifi_connecting.text[EN] = "Connecting...";
interface_text_wifi_nothing.text[EN] = "None...";
interface_text_settings_locale.text[EN] = "Language:";
@@ -104,7 +106,9 @@ void interface_init_label(void)
interface_text_headline_info.text[DE] = "INFOS";
interface_text_headline_debug.text[DE] = "DEBUG";
interface_text_wifi_waiting.text[DE] = "Warten...";
interface_text_wifi_scanning.text[DE] = "Scannen...";
interface_text_wifi_connecting.text[DE] = "Verbinden...";
interface_text_wifi_nothing.text[DE] = "Keine...";
interface_text_settings_locale.text[DE] = "Sprache:";
+16 -6
View File
@@ -43,6 +43,12 @@ void interface_wifi_input_rst(char *text, uint8_t cursor)
void interface_wifi_input_set(char *text, uint8_t cursor)
{
display_clear();
display_menu_headline(interface_get_label_text(&interface_text_headline_wifi), true, 0);
display_text_line_column(interface_get_label_text(&interface_text_wifi_connecting), 4, 1, false);
memcpy(current_wifi_config.sta.password, text, cursor + 1);
ESP_LOGD(INTERFACE_LOG, "ssid: '%s' password '%s'", current_wifi_config.sta.ssid, current_wifi_config.sta.password);
@@ -173,15 +179,16 @@ void interface_wifi_scan(void)
if (!interface_wifi_working)
{
interface_wifi_working = true;
display_clear();
display_menu_headline(interface_get_label_text(&interface_text_headline_wifi), true, 0);
display_text_line_column(interface_get_label_text(&interface_text_wifi_waiting), 4, 1, false);
ena_eke_proxy_pause();
memset(ap_info, 0, sizeof(ap_info));
ap_count = 0;
ap_index = 0;
ap_selected = 0;
ena_eke_proxy_pause();
display_clear();
display_menu_headline(interface_get_label_text(&interface_text_headline_wifi), true, 0);
display_text_line_column(interface_get_label_text(&interface_text_wifi_scanning), 4, 1, false);
wifi_controller_scan(ap_info, &ap_count, interface_wifi_display);
@@ -194,8 +201,11 @@ void interface_wifi_reconnect(void)
{
if (!interface_wifi_working)
{
display_clear();
display_menu_headline(interface_get_label_text(&interface_text_headline_wifi), true, 0);
display_text_line_column(interface_get_label_text(&interface_text_wifi_connecting), 4, 1, false);
interface_wifi_working = true;
wifi_controller_reconnect(NULL);
wifi_controller_reconnect(&interface_wifi_set);
interface_wifi_working = false;
}
}
+2
View File
@@ -98,7 +98,9 @@ interface_label_t interface_text_report_pending;
interface_label_t interface_text_report_success;
interface_label_t interface_text_report_fail;
interface_label_t interface_text_wifi_waiting;
interface_label_t interface_text_wifi_scanning;
interface_label_t interface_text_wifi_connecting;
interface_label_t interface_text_wifi_nothing;
interface_label_t interface_text_data_del[6];