OMOTE/Platformio/OmoteUI/OmoteUI.hpp

239 lines
6.4 KiB
C++
Raw Normal View History

Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
// OMOTE UI
// 2023 Matthew Colvin
#pragma once
#include "HardwareAbstract.hpp"
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
#include "Images.hpp"
Add platform io sim (#31) * Lower default SPI Clock Lowered the default SPI clock as some displays might show glitches with the SPI frequency set above 40MHz. * Added missing library components Added the missing library symbols, footprints and 3D-models. These are all in a project-specific library called "omoteLib" (#19) * Implement MQTT publish in HardwareRevX Change-Id: I7b6955a662716f83dd8daf34128a353efa26bf80 * add batteryStatus info and allow access to it through the interface. Change-Id: Ieb748b1478d532f52ffff9edc783de3cbcf9f303 * rename hardwareAbstractionInterface Change-Id: I39a9bcd7fc4d92b271a40a869faae7870d6d88a1 * rename HardwareAbstractionInterface files Change-Id: Ifb6a96c38da61cb80aabc6c929e392a2fc91cf29 * fixed a typo * Re work directory structure to support new architecture Still need to get the Sim building * lvgl simulator working. * put init code into HardwareSimulator Class * ensure all targets build remove unused assets.c add new github actions that reflect new simulator * clean up build defines by using platform.ini to override default lv_config. remove unneeded include directory. Change-Id: Id63baa80dae89977d239a539b5db9ff67266e1d6 * Fix ESP32 Windows build after battling escape characters. Add esp32 Windows target to Actions. * Fixed screen height - corrected the SCREEN_HEIGHT - small graphical changes in OmoteUI to make it look like in the main branch --------- Co-authored-by: Max <Max-MKA@web.de> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com> Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com>
2023-08-11 18:16:48 -04:00
#include "lvgl.h"
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
#include <algorithm>
#include <memory>
#include <stdio.h>
#include <string>
#include "poller.hpp"
Add platform io sim (#31) * Lower default SPI Clock Lowered the default SPI clock as some displays might show glitches with the SPI frequency set above 40MHz. * Added missing library components Added the missing library symbols, footprints and 3D-models. These are all in a project-specific library called "omoteLib" (#19) * Implement MQTT publish in HardwareRevX Change-Id: I7b6955a662716f83dd8daf34128a353efa26bf80 * add batteryStatus info and allow access to it through the interface. Change-Id: Ieb748b1478d532f52ffff9edc783de3cbcf9f303 * rename hardwareAbstractionInterface Change-Id: I39a9bcd7fc4d92b271a40a869faae7870d6d88a1 * rename HardwareAbstractionInterface files Change-Id: Ifb6a96c38da61cb80aabc6c929e392a2fc91cf29 * fixed a typo * Re work directory structure to support new architecture Still need to get the Sim building * lvgl simulator working. * put init code into HardwareSimulator Class * ensure all targets build remove unused assets.c add new github actions that reflect new simulator * clean up build defines by using platform.ini to override default lv_config. remove unneeded include directory. Change-Id: Id63baa80dae89977d239a539b5db9ff67266e1d6 * Fix ESP32 Windows build after battling escape characters. Add esp32 Windows target to Actions. * Fixed screen height - corrected the SCREEN_HEIGHT - small graphical changes in OmoteUI to make it look like in the main branch --------- Co-authored-by: Max <Max-MKA@web.de> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com> Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com>
2023-08-11 18:16:48 -04:00
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
/// @brief Singleton to allow UI code to live separately from the Initialization
/// of resources.
class OmoteUI {
public:
OmoteUI(std::shared_ptr<HardwareAbstract> aHardware);
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
static std::weak_ptr<OmoteUI> getRefrence() { return getInstance(); };
Add platform io sim (#31) * Lower default SPI Clock Lowered the default SPI clock as some displays might show glitches with the SPI frequency set above 40MHz. * Added missing library components Added the missing library symbols, footprints and 3D-models. These are all in a project-specific library called "omoteLib" (#19) * Implement MQTT publish in HardwareRevX Change-Id: I7b6955a662716f83dd8daf34128a353efa26bf80 * add batteryStatus info and allow access to it through the interface. Change-Id: Ieb748b1478d532f52ffff9edc783de3cbcf9f303 * rename hardwareAbstractionInterface Change-Id: I39a9bcd7fc4d92b271a40a869faae7870d6d88a1 * rename HardwareAbstractionInterface files Change-Id: Ifb6a96c38da61cb80aabc6c929e392a2fc91cf29 * fixed a typo * Re work directory structure to support new architecture Still need to get the Sim building * lvgl simulator working. * put init code into HardwareSimulator Class * ensure all targets build remove unused assets.c add new github actions that reflect new simulator * clean up build defines by using platform.ini to override default lv_config. remove unneeded include directory. Change-Id: Id63baa80dae89977d239a539b5db9ff67266e1d6 * Fix ESP32 Windows build after battling escape characters. Add esp32 Windows target to Actions. * Fixed screen height - corrected the SCREEN_HEIGHT - small graphical changes in OmoteUI to make it look like in the main branch --------- Co-authored-by: Max <Max-MKA@web.de> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com> Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com>
2023-08-11 18:16:48 -04:00
static std::shared_ptr<OmoteUI>
getInstance(std::shared_ptr<HardwareAbstract> aHardware = nullptr) {
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
if (mInstance) {
return mInstance;
} else if (aHardware) {
mInstance = std::make_shared<OmoteUI>(aHardware);
}
return mInstance;
};
// Set the page indicator scroll position relative to the tabview scroll
// position
void store_scroll_value_event_cb(lv_event_t *e);
// Update current device when the tabview page is changes
void tabview_device_event_cb(lv_event_t *e);
// Slider Event handler
void bl_slider_event_cb(lv_event_t *e);
// Apple Key Event handler
void appleKey_event_cb(lv_event_t *e);
// Wakeup by IMU Switch Event handler
void WakeEnableSetting_event_cb(lv_event_t *e);
// Smart Home Toggle Event handler
void smartHomeToggle_event_cb(lv_event_t *e);
// Smart Home Toggle Event handler
void smartHomeSlider_event_cb(lv_event_t *e);
// Virtual Keypad Event handler
void virtualKeypad_event_cb(lv_event_t *e);
void wifi_settings_cb(lv_event_t* event);
void connect_btn_cb(lv_event_t* event);
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
void password_field_event_cb(lv_event_t* e);
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
// Use LVGL to layout the ui and register the callbacks
void layout_UI();
void ta_kb_event_cb(lv_event_t* e);
void wifi_scan_done(std::shared_ptr<std::vector<WifiInfo>> info);
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
void loopHandler();
/**
* @brief Function to hide the keyboard. If the keyboard is attached to a text area, it will be hidden when the
* text area is defocused. This function can be used if the keyboard need to be hidden due to some script event.
*
*/
void hide_keyboard();
/**
* @brief Function to show the keyboard. If a text area needs the keybaord, it should be attached to the text area
* using the approbiate function. The keyboard will then show up when the text area is focused. This function is
* needed if the keyboard should be shown due to some script or other trigger.
*
*/
void show_keyboard();
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
private:
static std::shared_ptr<OmoteUI> mInstance;
std::shared_ptr<HardwareAbstract> mHardware;
std::unique_ptr<poller> batteryPoller;
void reset_settings_menu();
void attach_keyboard(lv_obj_t* textarea);
std::shared_ptr<std::vector<WifiInfo>> found_wifi_networks;
/**
* @brief Keyboard object used whenever a keyboard is needed.
*
*/
lv_obj_t* kb;
/**
* @brief Function to create the keyboard object which can then be attached to different text areas.
*
*/
void create_keyboard();
/**
* @brief Set the up settings object
*
* @param parent
*/
void setup_settings(lv_obj_t* parent);
/**
* @brief LVGL Menu for settings pages as needed.
*
*/
lv_obj_t* settingsMenu;
/**
* @brief Main page of the settings menu
*
*/
lv_obj_t* settingsMainPage;
/**
* @brief Battery percentage label
*
*/
lv_obj_t* objBattPercentage;
/**
* @brief Battery icon object in the status bar
*
*/
lv_obj_t* objBattIcon;
void create_status_bar();
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
lv_obj_t *panel = nullptr;
Images imgs = Images();
uint_fast8_t currentDevice = 4;
lv_color_t color_primary = lv_color_hex(0x303030); // gray
bool wakeupByIMUEnabled = true;
Add platform io sim (#31) * Lower default SPI Clock Lowered the default SPI clock as some displays might show glitches with the SPI frequency set above 40MHz. * Added missing library components Added the missing library symbols, footprints and 3D-models. These are all in a project-specific library called "omoteLib" (#19) * Implement MQTT publish in HardwareRevX Change-Id: I7b6955a662716f83dd8daf34128a353efa26bf80 * add batteryStatus info and allow access to it through the interface. Change-Id: Ieb748b1478d532f52ffff9edc783de3cbcf9f303 * rename hardwareAbstractionInterface Change-Id: I39a9bcd7fc4d92b271a40a869faae7870d6d88a1 * rename HardwareAbstractionInterface files Change-Id: Ifb6a96c38da61cb80aabc6c929e392a2fc91cf29 * fixed a typo * Re work directory structure to support new architecture Still need to get the Sim building * lvgl simulator working. * put init code into HardwareSimulator Class * ensure all targets build remove unused assets.c add new github actions that reflect new simulator * clean up build defines by using platform.ini to override default lv_config. remove unneeded include directory. Change-Id: Id63baa80dae89977d239a539b5db9ff67266e1d6 * Fix ESP32 Windows build after battling escape characters. Add esp32 Windows target to Actions. * Fixed screen height - corrected the SCREEN_HEIGHT - small graphical changes in OmoteUI to make it look like in the main branch --------- Co-authored-by: Max <Max-MKA@web.de> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com> Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com>
2023-08-11 18:16:48 -04:00
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
inline static const uint_fast8_t virtualKeyMapTechnisat[10] = {
0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x0};
/************************************** WIFI Settings Menu *******************************************************/
/**
* @brief Container within the wifi selection page
*/
lv_obj_t* wifi_setting_cont;
/**
* @brief Wifi settings entry point on the settings tab
*
*/
lv_obj_t* wifiOverview;
/**
* @brief Label in the wifi password page. This label is updated with the selected SSID when the credentials for
* a wifi network is entered.
*
*/
lv_obj_t* wifi_password_label;
/**
* @brief Menu Subpage for the wifi password
*/
lv_obj_t* wifi_password_page;
/**
* @brief Menu Subpage for wifi selection
*/
lv_obj_t* wifi_selection_page;
/**
* @brief Wifi Label shown in the top status bar
*/
lv_obj_t* WifiLabel;
/**
* @brief Number of wifi subpage needed to display the found wifi networks
*
*/
unsigned int no_subpages;
/**
* @brief number of wifi networks found
*
*/
unsigned int no_wifi_networks;
void wifi_status(std::shared_ptr<wifiStatus> status);
/**
* @brief callback function to get next wifi subpage. This callback can be used to get the next or previous page
*
* @param e lvgl event object
*/
void next_wifi_selection_subpage(lv_event_t* e);
/**
* @brief Create a wifi selection sub page object
*
* @param menu LVGL Menu where the sub page should be added to
* @return lv_obj_t* Menu sub page object pointer
*/
lv_obj_t* create_wifi_selection_page(lv_obj_t* menu);
/**
* @brief Method to create the wifi password sub page
*
* @param menu Menu where the sub page should be created
* @return lv_obj_t* menu sub page object pointer
*/
lv_obj_t* create_wifi_password_page(lv_obj_t* menu);
/**
* @brief Method to create the wifi settings on the main page
*
* @param parent lv object parent where the main settings page should be added to
*/
void create_wifi_main_page(lv_obj_t* parent);
/**
* @brief Method to create wifi settings. This method will call the create_wifi_selection_page,
* the create_wifi_password_page, and the create_wifi_main_page
*
* @param menu Settings menu where the sub pages should be added to
* @param parent lv object parent where the main settings page should be added to
*/
void create_wifi_settings(lv_obj_t* menu, lv_obj_t* parent);
/**
* @brief Function to update the wifi selection sub page
*
* @param page index of the page to display
*/
void update_wifi_selection_subpage(int page);
/**
* @brief Function to create the display settings page.
*
* @param parent LVGL object acting as a parent for the display settings page
*/
void display_settings(lv_obj_t* parent);
Lay the ground work for a hardware abstraction layer (#15) * Pull out OmoteUI into its own hpp/cpp that only controls UI/UX Added HardwareAbstractionInterface to allow UI to be decoupled Add OmoteUI class/Header to visual studio solution Bump the compiler to c++17 for std::clamp * code format update visual studio solution to build all versions properly Pull pin defs into config file use config file to allow USE_SIMULATOR checks in OmoteUI this will allow the sim to compile in specific code within the UI * put pin mode config into hardwarerevX class along with some other hardware things. Still lots of work to pull everything into the HAL. Change-Id: If3cacc43d43670b0ff2233140b1cff66a4aeb48d * pull Prefrences, IMU interrupt and sleep into the hardware class Change-Id: I082ae086ed70306789df80eafce8870a5cdfd125 * pull in touch screen, IMU and slow screen wake into hardware Change-Id: I61b49a6d0551463becbc3bdf1418ac9fde9d9376 * Pull wifi and IR into Hardware RevX pull last bit of global variables into hardware rev * un public everything * clean up simulator build * rename loop handler reorder setup to better match the origional main * Add Loop Handler that updates UI * Add images to their own file to shrink OmoteUI * Allow Wifi to be turned off with the macro * Update Battery Update Task instead of a time based check and update * Clean up abstract interface move defenitions out of hardwareRevX.hpp into cpp * reorder HardwareRevX functions * Add comment blocks to top of headers --------- Co-authored-by: Matthew Colvin <35540398+Mc067415@users.noreply.github.com> Co-authored-by: Matthew Colvin <Matthew.Colvin@garmin.com>
2023-07-31 14:28:10 -04:00
};