Compare commits
2 Commits
6d878cc41b
...
6b83634e72
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b83634e72 | |||
| bb1eee6cda |
7
Raumtermostat/.vscode/settings.json
vendored
7
Raumtermostat/.vscode/settings.json
vendored
@ -70,6 +70,11 @@
|
||||
"arduino.h": "c",
|
||||
"actions.h": "c",
|
||||
"glbldata.h": "c",
|
||||
"vars.h": "c"
|
||||
"vars.h": "c",
|
||||
"fonts.h": "c",
|
||||
"images.h": "c",
|
||||
"tahoma.h": "c",
|
||||
"httpclient.h": "c",
|
||||
"base64.h": "c"
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@ monitor_speed = 115200
|
||||
framework = arduino
|
||||
board_build.partitions = min_spiffs.csv
|
||||
;upload_protocol = espota
|
||||
;upload_port = TMP-EG-Bad.fritz.box
|
||||
;upload_port = 192.168.179.41
|
||||
lib_deps =
|
||||
moononournation/GFX Library for Arduino@^1.5.3
|
||||
lvgl/lvgl@^9.2.2
|
||||
@ -26,4 +26,4 @@ build_flags =
|
||||
-D LV_LVGL_H_INCLUDE_SIMPLE
|
||||
-I src
|
||||
;to install on all targets:
|
||||
;(pio run -t nobuild -t upload --upload-port TMP-EG-WoZi.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-EG-Florian.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-EG-Bad.fritz.box)
|
||||
;(pio run -t nobuild -t upload --upload-port TMP-EG-WoZi.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-EG-Florian.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-EG-Bad.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-OG-Bad.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-OG-Buero.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-OG-KiZi.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-OGSchlafen.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-OGWoZi.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-UG-Bad.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-UG-Buero.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-UG-Kueche.fritz.box)
|
||||
@ -47,6 +47,7 @@ void MQTT::begin(){
|
||||
wm.addParameter(&custom_ntpServer);
|
||||
psclient.setClient(client);
|
||||
psclient.setServer(Settings::prefs.mqtt_server,Settings::prefs.mqtt_port);
|
||||
psclient.setCallback(receiveTopic);
|
||||
WiFi.setHostname(custom_hostname.getValue()); //define hostname
|
||||
wm.setConfigPortalBlocking(false);
|
||||
if(wm.autoConnect("TempReglerAP")){
|
||||
@ -127,11 +128,16 @@ void MQTT::saveConfigToFlash(void){
|
||||
Settings::getInstance().saveSettings(); // Save dataset to persistent storage
|
||||
}
|
||||
|
||||
void MQTT::receiveTopic(char* topic, byte* payload, unsigned int length) {
|
||||
glblData.outTemp = String((char*)payload).toFloat();
|
||||
}
|
||||
|
||||
void MQTT::reconnect(void) {
|
||||
// Loop until we're reconnected
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
// Attempt to connect
|
||||
if (psclient.connect(Settings::prefs.hostname)) {
|
||||
psclient.subscribe("weatherStation/tempAmb");
|
||||
Serial.println("connected");
|
||||
|
||||
} else {
|
||||
|
||||
@ -40,6 +40,7 @@ public:
|
||||
char* getHostname(void);
|
||||
char* getMqttTopic(void);
|
||||
char* getMyIP(void);
|
||||
static void receiveTopic(char* topic, byte* payload, unsigned int length);
|
||||
void begin();
|
||||
void loop(void);
|
||||
void publish(const char* msg);
|
||||
|
||||
@ -485,8 +485,8 @@
|
||||
#define LV_FONT_MONTSERRAT_12 0
|
||||
#define LV_FONT_MONTSERRAT_14 1
|
||||
#define LV_FONT_MONTSERRAT_16 0
|
||||
#define LV_FONT_MONTSERRAT_18 0
|
||||
#define LV_FONT_MONTSERRAT_20 1
|
||||
#define LV_FONT_MONTSERRAT_18 1
|
||||
#define LV_FONT_MONTSERRAT_20 0
|
||||
#define LV_FONT_MONTSERRAT_22 0
|
||||
#define LV_FONT_MONTSERRAT_24 0
|
||||
#define LV_FONT_MONTSERRAT_26 0
|
||||
@ -586,7 +586,7 @@
|
||||
|
||||
#define LV_USE_ARC 1
|
||||
|
||||
#define LV_USE_BAR 0
|
||||
#define LV_USE_BAR 1
|
||||
|
||||
#define LV_USE_BUTTON 1
|
||||
|
||||
@ -613,7 +613,7 @@
|
||||
|
||||
#define LV_USE_CHECKBOX 0
|
||||
|
||||
#define LV_USE_DROPDOWN 0 /*Requires: lv_label*/
|
||||
#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
|
||||
|
||||
#define LV_USE_IMAGE 1 /*Requires: lv_label*/
|
||||
|
||||
@ -644,7 +644,7 @@
|
||||
|
||||
#define LV_USE_SCALE 1
|
||||
|
||||
#define LV_USE_SLIDER 0 /*Requires: lv_bar*/
|
||||
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
|
||||
|
||||
#define LV_USE_SPAN 1
|
||||
#if LV_USE_SPAN
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include <Ticker.h>
|
||||
#include <PubSubClient.h>
|
||||
#include "MQTT.h"
|
||||
#include <tahoma.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
#define MEASINT_S 5
|
||||
@ -28,7 +27,7 @@
|
||||
|
||||
MQTT mqtt;
|
||||
Ticker measurementTick;
|
||||
Tahoma tahoma("1215-2900-8489.local","67ebd23e3a61763386d9");
|
||||
|
||||
unsigned char ChipID = 0x00;
|
||||
volatile bool TouchEventFlag = false;
|
||||
|
||||
@ -153,12 +152,16 @@ void loop()
|
||||
chart_autoscale();
|
||||
lv_chart_refresh(objects.chart);
|
||||
}
|
||||
if(millis() - minutesTick > 10000){
|
||||
if(millis() - minutesTick > 60000){
|
||||
minutesTick = millis();
|
||||
if(mqtt.wifiConnected){
|
||||
update_wifi_strength(glblData.wifiStrength,glblData.wifiMode);
|
||||
}
|
||||
}
|
||||
if(millis() - secondsTick > 1000){
|
||||
secondsTick = millis();
|
||||
//update_clockdots();
|
||||
}
|
||||
mqtt.loop();
|
||||
ui_tick();
|
||||
if(!ui_isSleeping()){
|
||||
|
||||
@ -1,121 +0,0 @@
|
||||
#include "tahoma.h"
|
||||
|
||||
const char* rootCACertificate = "-----BEGIN CERTIFICATE-----\n"\
|
||||
"MIIDUTCCAjmgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBLMRAwDgYDVQQKEwdPdmVy\n"\
|
||||
"a2l6MRAwDgYDVQQLEwdSb290IENBMRgwFgYDVQQDEw9PdmVya2l6IFJvb3QgQ0Ex\n"\
|
||||
"CzAJBgNVBAYTAkZSMB4XDTE2MDQyNzEyNTgxN1oXDTM2MDQyMjEyNTgxN1owZTEL\n"\
|
||||
"MAkGA1UEBhMCRlIxEDAOBgNVBAoTB092ZXJraXoxITAfBgNVBAsTGE92ZXJraXog\n"\
|
||||
"RGV2aWNlIFNlcnZlciBDQTEhMB8GA1UEAxMYT3ZlcmtpeiBEZXZpY2UgU2VydmVy\n"\
|
||||
"IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzr/hwPW3ykSV+Rv/\n"\
|
||||
"u+i1It8gq6aX4yLAP5vdrhzHGFrsNAhbviVe2SajBejfbuWTs0AvA03yHDsRhvlO\n"\
|
||||
"rKUXFg2ZekipgkI+yqii6bmk3Qsqp/DNCoogp+Rg0qFivT4DGxmKio1cPU4i2mXc\n"\
|
||||
"yIkSTR4bDUbhrFT+6ahEoYjcwvPaRxGUUobIpqJXDexPMzBSvy6/dLBay0Q1RMQ8\n"\
|
||||
"LSyLtc/Zl1HkNTgSen9tHoq4A0JMeheLW47/HKgMYeQkeIsjzCKduLhZea893EYY\n"\
|
||||
"tPS/EUlNfK0YiYbI4UIdNvJ6N0iu85KDreytFT7XAVnZSAbmLXuqtQC0U7EM7jEq\n"\
|
||||
"uepAuwIDAQABoyYwJDASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIB\n"\
|
||||
"BjANBgkqhkiG9w0BAQsFAAOCAQEAkxcJ80vpnS4VyBQMLbvmncg06b65tlCndSJm\n"\
|
||||
"MXMS6rwdAhUs84Gqu6H/vN3k1ix4iYty/n7MPfyYOznidMANayXurf0YMdIDagoE\n"\
|
||||
"Gv2QVOl63Oe7xhKbcdAgejDAewyXbC8+cZj156itUSQZjmNdZ/59pt7lMkV6YDR2\n"\
|
||||
"pOPnPjqG16TQ7ju2iYonhoHPd/iWs7iKcBs8/eaMYxcpqQDbX+O6hN5qPcTBfGRB\n"\
|
||||
"TFqwgSu0abNIZ3IJuSUGxkoPcIxNWLTxnwCgUN+TQTrg6rWw8T7GtSzKBljVk09R\n"\
|
||||
"9YmKHPhUN7wjNRzWiecfomTi3FTgYbrzbwCSTj3FAogCxuHAwA==\n"\
|
||||
"-----END CERTIFICATE-----\n";
|
||||
|
||||
Tahoma::Tahoma(const String _hostname, const String _token) : connected(false) {
|
||||
hostname = _hostname;
|
||||
token = _token;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Tahoma::~Tahoma() {
|
||||
|
||||
}
|
||||
|
||||
String url_encode(const String &value) {
|
||||
String escaped;
|
||||
|
||||
for (uint16_t i = 0; i < value.length(); i++) {
|
||||
|
||||
char c = value.charAt(i);
|
||||
// Keep alphanumeric and other accepted characters intact
|
||||
if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
|
||||
escaped += c;
|
||||
continue;
|
||||
}else{
|
||||
// Any other characters are percent-encoded
|
||||
if(c < 0x10){
|
||||
escaped += "%0" + String(c, HEX);
|
||||
}else{
|
||||
escaped += '%' + String(c, HEX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return escaped;
|
||||
}
|
||||
|
||||
String Tahoma::getDeviceName(const String _url)
|
||||
{
|
||||
//String url = "/enduser-mobile-web/1/enduserAPI/apiVersion"; // Construct the URL to fetch the device name
|
||||
HTTPClient http; // Create an HTTP client object
|
||||
String url = "/enduser-mobile-web/1/enduserAPI/setup/devices/" + url_encode(_url) + "/states/core:NameState"; // Construct the URL to fetch the device name
|
||||
String deviceName;
|
||||
http.begin("1215-2900-8489.local",8443,url,rootCACertificate); // Initialize the HTTP connection
|
||||
http.addHeader("Authorization", "Bearer " + token); // Add the authorization header with the token
|
||||
int httpCode = http.GET(); // Send the GET request and get the response code
|
||||
if (httpCode > 0) { // Check if the request was successful
|
||||
JsonDocument doc; // Create a JSON document to parse the response
|
||||
String response = http.getString(); // Get the response as a string
|
||||
deserializeJson(doc,response); // Deserialize the JSON response
|
||||
Serial.println(response); // Print the response to the serial monitor for debugging
|
||||
if (doc["value"].isNull()) { // Check if the value is null
|
||||
Serial.println("Device not found"); // Print error message if the device is not found
|
||||
}else{
|
||||
deviceName = doc["value"].as<String>(); // Get the device name from the JSON response
|
||||
Serial.println("Device Name: " + deviceName); // Print the device name to the serial monitor
|
||||
}
|
||||
} else {
|
||||
Serial.print("Error on HTTP request:"); // Print error message if the request failed
|
||||
Serial.println(httpCode); // Print the error code
|
||||
Serial.print("Error message: "); // Print error message
|
||||
Serial.println(http.errorToString(httpCode)); // Print the error code
|
||||
Serial.println(url); // Print the URL for debugging
|
||||
}
|
||||
http.end(); // Close the HTTP connection
|
||||
return deviceName; // Return the device name
|
||||
}
|
||||
|
||||
|
||||
void Tahoma::getAllDevices(void){
|
||||
HTTPClient http; // Create an HTTP client object
|
||||
String url = "/enduser-mobile-web/1/enduserAPI/setup/devices/controllables/io%3AExteriorVenetianBlindIOComponent"; // Construct the URL to fetch all devices
|
||||
http.begin("1215-2900-8489.local",8443,url,rootCACertificate); // Initialize the HTTP connection
|
||||
http.addHeader("Authorization", "Bearer " + token); // Add the authorization header with the token
|
||||
int httpCode = http.GET(); // Send the GET request and get the response code
|
||||
if (httpCode > 0) { // Check if the request was successful
|
||||
JsonDocument doc; // Create a JSON document to parse the response
|
||||
String response = http.getString(); // Get the response as a string
|
||||
deserializeJson(doc,response); // Deserialize the JSON response
|
||||
if(doc.size() > 0){ // Check if the JSON document is not empty
|
||||
for (int i = 0; i < doc.size(); i++) { // Loop through the JSON array
|
||||
devicelist[i].url = doc[i].as<String>(); // Get the device URL from the JSON response
|
||||
Serial.println("Device URL: " + devicelist[i].url); // Print the device URL to the serial monitor
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Serial.print("Error on HTTP request:"); // Print error message if the request failed
|
||||
Serial.println(httpCode); // Print the error code
|
||||
Serial.print("Error message: "); // Print error message
|
||||
Serial.println(http.errorToString(httpCode)); // Print the error code
|
||||
}
|
||||
http.end(); // Close the HTTP connection
|
||||
}
|
||||
void Tahoma::getAllDeviceNames(void){
|
||||
for (int i = 0; i < MAX_NUM_DEVICES; i++) { // Loop through the JSON array
|
||||
if(devicelist[i].url == ""){ // Check if the device URL is empty
|
||||
break; // Break the loop if the device URL is empty
|
||||
}
|
||||
devicelist[i].name = getDeviceName(devicelist[i].url); // Get the device name using the device URL
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
#ifndef TAHOMA_H
|
||||
#define TAHOMA_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <WiFi.h>
|
||||
#include <iostream>
|
||||
#include <base64.h>
|
||||
#include <HTTPClient.h>
|
||||
#include <ArduinoJson.h> // Include the ArduinoJson library for JSON parsing
|
||||
#include <ESPAsyncWebserver.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#define MAX_NUM_DEVICES 32 // Maximum number of devices to fetch
|
||||
|
||||
class Tahoma {
|
||||
public:
|
||||
typedef struct {
|
||||
String name; // Device name
|
||||
String url; // Device URL
|
||||
} device_t;
|
||||
// Constructor with hostname and token
|
||||
// Initializes the Tahoma object with the provided hostname and token
|
||||
Tahoma(const String hostname, const String token);
|
||||
|
||||
// Destructor
|
||||
~Tahoma();
|
||||
void getAllDevices(void); // Fetches the device name from the Tahoma system
|
||||
String getDeviceName(const String _url); // Fetches the device name from the Tahoma system
|
||||
void getAllDeviceNames(void); // Fetches all device names from the Tahoma system
|
||||
private:
|
||||
device_t devicelist[MAX_NUM_DEVICES];
|
||||
String hostname; // Hostname of the Tahoma system
|
||||
String token; // Authentication token for the Tahoma system
|
||||
bool connected; // Connection status
|
||||
|
||||
// Simulate fetching data from the Tahoma system
|
||||
void fetchData();
|
||||
};
|
||||
|
||||
#endif // TAHOMA_H
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3712
Raumtermostat/src/ui/Bootstrap_Icons_20.c
Normal file
3712
Raumtermostat/src/ui/Bootstrap_Icons_20.c
Normal file
File diff suppressed because it is too large
Load Diff
4809
Raumtermostat/src/ui/Bootstrap_Icons_24.c
Normal file
4809
Raumtermostat/src/ui/Bootstrap_Icons_24.c
Normal file
File diff suppressed because it is too large
Load Diff
6983
Raumtermostat/src/ui/Bootstrap_Icons_30.c
Normal file
6983
Raumtermostat/src/ui/Bootstrap_Icons_30.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,18 @@ void update_sensorNstatus(float temp, float hum, float seaLevelPress, bool presA
|
||||
glblData.presAlarm = presAlarm;
|
||||
update_status();
|
||||
}
|
||||
void update_clockdots(void){
|
||||
static bool dotState = false;
|
||||
dotState = !dotState;
|
||||
char* time = lv_label_get_text(objects.time_txt);
|
||||
if(dotState){
|
||||
time[3] = ':';
|
||||
lv_label_set_text(objects.time_txt, time);
|
||||
}else{
|
||||
time[3] = ' ';
|
||||
lv_label_set_text(objects.time_txt, time);
|
||||
}
|
||||
}
|
||||
|
||||
static void alarm_ani_cb(void * var, int32_t v)
|
||||
{
|
||||
@ -34,17 +46,23 @@ static void alarm_ani_end_cb(lv_anim_t *var)
|
||||
}
|
||||
|
||||
void ui_settemp(float tmp){
|
||||
lv_arc_set_value(objects.temp_arc, (int32_t) (tmp*2));
|
||||
lv_arc_set_value(objects.temp_arc, (int32_t) (tmp));
|
||||
}
|
||||
|
||||
void update_status(void){
|
||||
tm timeinfo;
|
||||
getLocalTime(&timeinfo);
|
||||
char buffer[15];
|
||||
strftime(buffer, sizeof(buffer), "%H : %M", &timeinfo);
|
||||
static unsigned long fullOnTime = millis();
|
||||
lv_label_set_text_fmt(objects.press_txt,"%4.2f hPa",glblData.seaLevelPress);
|
||||
lv_label_set_text_fmt(objects.hum_txt,"%2.0f %%rH",glblData.hum);
|
||||
lv_label_set_text_fmt(objects.outTemp_txt,ICON_THERMOMETER_SNOW "%2.1f °C",glblData.outTemp);
|
||||
lv_label_set_text(objects.time_txt,buffer);
|
||||
if(!arc_pressed && !animating){
|
||||
lv_label_set_text_fmt(objects.temp_txt,"%2.1f °C",glblData.temp);
|
||||
}else{
|
||||
glblData.settemp = lv_arc_get_value(objects.temp_arc)/2.0;
|
||||
glblData.settemp = lv_arc_get_value(objects.temp_arc);
|
||||
lv_label_set_text_fmt(objects.temp_txt,"%2.1f °C",glblData.settemp);
|
||||
}
|
||||
if(glblData.enBuff){
|
||||
@ -162,7 +180,7 @@ void chartDrawingCB(lv_event_t * e){
|
||||
draw_line_dsc.dash_gap = 1;
|
||||
draw_line_dsc.dash_width = 2;
|
||||
draw_line_dsc.p1.x = chart_obj_coords.x1+5;
|
||||
draw_line_dsc.p1.y = lv_obj_get_y2(objects.y_scale) - (lv_obj_get_height(objects.y_scale)*(lv_arc_get_value(objects.temp_arc)-scale_min*2)*5)/((scale_max-scale_min)*10) -1;
|
||||
draw_line_dsc.p1.y = lv_obj_get_y2(objects.y_scale) - (lv_obj_get_height(objects.y_scale)*(lv_arc_get_value(objects.temp_arc)-scale_min)*10)/((scale_max-scale_min)*10) -1;
|
||||
draw_line_dsc.p2.x = chart_obj_coords.x2-5;
|
||||
draw_line_dsc.p2.y = draw_line_dsc.p1.y;
|
||||
lv_draw_line(layer,&draw_line_dsc);
|
||||
@ -380,11 +398,33 @@ void showChartScreen(lv_event_t * e){
|
||||
loadChart(0);
|
||||
loadScreen(SCREEN_ID_CHART);
|
||||
}
|
||||
void showMenuScreen(lv_event_t * e){
|
||||
loadScreen(SCREEN_ID_MENU);
|
||||
}
|
||||
|
||||
void moveRolloUp(lv_event_t * e){
|
||||
}
|
||||
|
||||
void moveRolloDown(lv_event_t * e){
|
||||
}
|
||||
|
||||
void moveRolloMan(lv_event_t * e){
|
||||
}
|
||||
|
||||
void showDebugScreen(lv_event_t * e){
|
||||
loadScreen(SCREEN_ID_DEBUG);
|
||||
}
|
||||
|
||||
void showRolloScreen(lv_event_t * e){
|
||||
String devices = "";
|
||||
lv_dropdown_set_options(objects.deviceDropdown, devices.c_str());
|
||||
loadScreen(SCREEN_ID_ROLLO);
|
||||
}
|
||||
|
||||
void showRolloPosScreen(lv_event_t * e){
|
||||
loadScreen(SCREEN_ID_ROLLOPOS);
|
||||
}
|
||||
|
||||
void rebootESP(lv_event_t * e){
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
@ -14,12 +14,19 @@ void ui_settemp(float tmp);
|
||||
void action_zoom_set_temp(lv_event_t * e);
|
||||
void action_switch_screens(lv_event_t * e);
|
||||
void showDebugScreen(lv_event_t * e);
|
||||
void showMenuScreen(lv_event_t * e);
|
||||
void showChartScreen(lv_event_t * e);
|
||||
void showMainScreen(lv_event_t * e);
|
||||
void showRolloScreen(lv_event_t * e);
|
||||
void showRolloPosScreen(lv_event_t * e);
|
||||
void moveRolloUp(lv_event_t * e);
|
||||
void moveRolloDown(lv_event_t * e);
|
||||
void moveRolloMan(lv_event_t * e);
|
||||
void rebootESP(lv_event_t * e);
|
||||
void action_show_cursors_cb(lv_event_t * e);
|
||||
void chartDrawingCB(lv_event_t * e);
|
||||
void update_sensorNstatus(float temp, float hum, float seaLevelPress, bool presAlarm);
|
||||
void update_clockdots(void);
|
||||
void update_status(void);
|
||||
void update_wifi_strength(wifistrength_t strength, wifimode_t mode);
|
||||
void chart_autoscale(void);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -8,9 +8,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _objects_t {
|
||||
lv_obj_t *main;
|
||||
lv_obj_t *second;
|
||||
lv_obj_t *debug;
|
||||
lv_obj_t *mainScr;
|
||||
lv_obj_t *chartScr;
|
||||
lv_obj_t *debugScr;
|
||||
lv_obj_t *menuScr;
|
||||
lv_obj_t *rolloScr;
|
||||
lv_obj_t *rollo_posScr;
|
||||
lv_obj_t *temp_arc;
|
||||
lv_obj_t *temp_txt;
|
||||
lv_obj_t *hum_txt;
|
||||
@ -27,6 +30,12 @@ typedef struct _objects_t {
|
||||
lv_obj_t *bufferIcn;
|
||||
lv_obj_t *wifiIcn;
|
||||
lv_obj_t *alarmLED;
|
||||
lv_obj_t *outTemp_txt;
|
||||
lv_obj_t *time_txt;
|
||||
lv_obj_t *deviceDropdown;
|
||||
lv_obj_t *rolloPosSldr;
|
||||
lv_obj_t *lamellaContainer;
|
||||
lv_obj_t *lam[9];
|
||||
lv_chart_cursor_t *chart_cursor;
|
||||
lv_chart_series_t *chart_series;
|
||||
} objects_t;
|
||||
@ -36,7 +45,10 @@ extern objects_t objects;
|
||||
typedef enum ScreensEnum {
|
||||
SCREEN_ID_MAIN = 1,
|
||||
SCREEN_ID_CHART = 2,
|
||||
SCREEN_ID_DEBUG = 3
|
||||
SCREEN_ID_DEBUG = 3,
|
||||
SCREEN_ID_MENU = 4,
|
||||
SCREEN_ID_ROLLO = 5,
|
||||
SCREEN_ID_ROLLOPOS = 6,
|
||||
}ScreensEnum;
|
||||
|
||||
typedef enum ChartsEnum {
|
||||
@ -49,6 +61,7 @@ typedef enum ChartsEnum {
|
||||
|
||||
void create_screen_main();
|
||||
void create_screen_chart();
|
||||
|
||||
void create_screens();
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,78 @@
|
||||
#include "ui.h"
|
||||
#include "screens.h"
|
||||
|
||||
//
|
||||
// Style: Button
|
||||
//
|
||||
|
||||
void init_style_button_MAIN_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xff2f3237));
|
||||
lv_style_set_text_font(style, &Bootstrap_Icons_18);
|
||||
};
|
||||
|
||||
lv_style_t *get_style_button_MAIN_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_button_MAIN_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void add_style_button(lv_obj_t *obj) {
|
||||
lv_obj_add_style(obj, get_style_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
void remove_style_button(lv_obj_t *obj) {
|
||||
lv_obj_remove_style(obj, get_style_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
//
|
||||
// Style: slider
|
||||
//
|
||||
|
||||
void init_style_slider_MAIN_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xff2f3237));
|
||||
lv_style_set_bg_opa(style, 255);
|
||||
};
|
||||
|
||||
lv_style_t *get_style_slider_MAIN_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_slider_MAIN_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void init_style_slider_INDICATOR_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xff56f321));
|
||||
lv_style_set_shadow_width(style, 10);
|
||||
lv_style_set_shadow_color(style, lv_color_hex(0xff56f321));
|
||||
};
|
||||
|
||||
lv_style_t *get_style_slider_INDICATOR_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_slider_INDICATOR_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void add_style_slider(lv_obj_t *obj) {
|
||||
lv_obj_add_style(obj, get_style_slider_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_add_style(obj, get_style_slider_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
void remove_style_slider(lv_obj_t *obj) {
|
||||
lv_obj_remove_style(obj, get_style_slider_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_remove_style(obj, get_style_slider_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
//
|
||||
// Style: arc
|
||||
//
|
||||
@ -24,6 +96,7 @@ lv_style_t *get_style_arc_MAIN_DEFAULT() {
|
||||
return style;
|
||||
};
|
||||
|
||||
|
||||
void init_style_arc_INDICATOR_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_arc_color(style, lv_color_hex(0xff8ff321));
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xffffffff));
|
||||
@ -65,24 +138,3 @@ void remove_style_arc(lv_obj_t *obj) {
|
||||
lv_obj_remove_style(obj, get_style_arc_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
lv_obj_remove_style(obj, get_style_arc_KNOB_DEFAULT(), LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
void add_style(lv_obj_t *obj, int32_t styleIndex) {
|
||||
typedef void (*AddStyleFunc)(lv_obj_t *obj);
|
||||
static const AddStyleFunc add_style_funcs[] = {
|
||||
add_style_arc,
|
||||
};
|
||||
add_style_funcs[styleIndex](obj);
|
||||
}
|
||||
|
||||
void remove_style(lv_obj_t *obj, int32_t styleIndex) {
|
||||
typedef void (*RemoveStyleFunc)(lv_obj_t *obj);
|
||||
static const RemoveStyleFunc remove_style_funcs[] = {
|
||||
remove_style_arc,
|
||||
};
|
||||
remove_style_funcs[styleIndex](obj);
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,10 @@ lv_style_t *get_style_arc_INDICATOR_DEFAULT();
|
||||
lv_style_t *get_style_arc_KNOB_DEFAULT();
|
||||
void add_style_arc(lv_obj_t *obj);
|
||||
void remove_style_arc(lv_obj_t *obj);
|
||||
|
||||
void add_style_button(lv_obj_t *obj);
|
||||
void remove_style_button(lv_obj_t *obj);
|
||||
void add_style_slider(lv_obj_t *obj);
|
||||
void remove_style_slider(lv_obj_t *obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -3,335 +3,334 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SYMBOLS_H
|
||||
#define SYMBOLS_H
|
||||
#ifndef SYMBOLS_H
|
||||
#define SYMBOLS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
LV_FONT_DECLARE(Bootstrap_Icons_16);
|
||||
LV_FONT_DECLARE(Bootstrap_Icons_18);
|
||||
//included icons in bootstrap font
|
||||
//use this list for font generator:
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
LV_FONT_DECLARE(Bootstrap_Icons_12);
|
||||
LV_FONT_DECLARE(Bootstrap_Icons_18);
|
||||
LV_FONT_DECLARE(Bootstrap_Icons_30);
|
||||
// included icons in bootstrap font
|
||||
// use this list for font generator:
|
||||
/*
|
||||
0xF619-0xF61C,0xF7F6,0xF4FF,0xF185-0xF188,0xF30B-0xF30D,0xF493,0xF4F7,
|
||||
0xF5CD-0xF5D2,0xF100,0xF479,0xF5D4,0xF5D3,0xF116,0xF117,0xF3F2,0xF229,0xF22C,0xF235,0xF238,0xF22D,0xF230,0xF231,0xF234
|
||||
|
||||
https://www.cogsci.ed.ac.uk/~richard/utf-8.cgi?input=f287&mode=hex
|
||||
*/
|
||||
#define ICON_WIFI_LOW "\xEF\x98\x99" //F619
|
||||
#define ICON_WIFI_MED "\xEF\x98\x9A" //F61A
|
||||
#define ICON_WIFI_HIGH "\xEF\x98\x9C" //F61C
|
||||
#define ICON_WIFI_OFF "\xEF\x98\x9B" //F61B
|
||||
#define ICON_FIRE "\xEF\x9F\xB6" //F7F6
|
||||
#define ICON_POWER "\xEF\x93\xBF" //F4FF
|
||||
#define ICON_BATT_CHARG "\xEF\x86\x85" //F185
|
||||
#define ICON_BATT_FULL "\xEF\x86\x86" //F186
|
||||
#define ICON_BATT_HALF "\xEF\x86\x87" //F187
|
||||
#define ICON_BATT "\xEF\x86\x88" //F188
|
||||
#define ICON_DROPLET_FULL "\xEF\x8C\x8B" //F30B
|
||||
#define ICON_DROPLET_HALF "\xEF\x8C\x8C" //F30C
|
||||
#define ICON_DROPLET "\xEF\x8C\x8D" //F30D
|
||||
#define ICON_MOISTURE "\xEF\x92\x93" //F493
|
||||
#define ICON_PLUG "\xEF\x93\xB7" //F4F7
|
||||
#define ICON_THERMOMETER_HALF "\xEF\x97\x8D" //F5CD
|
||||
#define ICON_THERMOMETER_HIGH "\xEF\x97\x8E" //F5CE
|
||||
#define ICON_THERMOMETER_LOW "\xEF\x97\x8F" //F5CF
|
||||
#define ICON_THERMOMETER_SNOW "\xEF\x97\x90" //F5D0
|
||||
#define ICON_THERMOMETER_SUN "\xEF\x97\x91" //F5D1
|
||||
#define ICON_THERMOMETER "\xEF\x97\x92" //F5D2
|
||||
#define ICON_SHUTTER "" //F100
|
||||
#define ICON_MENU_LINES "" //F479
|
||||
#define ICON_MENU_DOTS_H "" //F5D4
|
||||
#define ICON_MENU_DOTS_V "" //F5D3
|
||||
#define ICON_ROTATE_CW "" //F116
|
||||
#define ICON_ROTATE_CC "" //F117
|
||||
#define ICON_GRAPH "" //F3F2
|
||||
#define ICON_ARROW_DOWN_FILL "" //F229
|
||||
#define ICON_ARROW_DOWN "" //F22C
|
||||
#define ICON_ARROW_UP_FILL "" //F235
|
||||
#define ICON_ARROW_UP "" //F238
|
||||
#define ICON_ARROW_LEFT_FILL "" //F22D
|
||||
#define ICON_ARROW_LEFT "" //F230
|
||||
#define ICON_ARROW_RIGHT_FILL "" //F231
|
||||
#define ICON_ARROW_RIGHT "" //F234
|
||||
#define ICON_WIFI_LOW "\xEF\x98\x99" // F619
|
||||
#define ICON_WIFI_MED "\xEF\x98\x9A" // F61A
|
||||
#define ICON_WIFI_HIGH "\xEF\x98\x9C" // F61C
|
||||
#define ICON_WIFI_OFF "\xEF\x98\x9B" // F61B
|
||||
#define ICON_FIRE "\xEF\x9F\xB6" // F7F6
|
||||
#define ICON_POWER "\xEF\x93\xBF" // F4FF
|
||||
#define ICON_BATT_CHARG "\xEF\x86\x85" // F185
|
||||
#define ICON_BATT_FULL "\xEF\x86\x86" // F186
|
||||
#define ICON_BATT_HALF "\xEF\x86\x87" // F187
|
||||
#define ICON_BATT "\xEF\x86\x88" // F188
|
||||
#define ICON_DROPLET_FULL "\xEF\x8C\x8B" // F30B
|
||||
#define ICON_DROPLET_HALF "\xEF\x8C\x8C" // F30C
|
||||
#define ICON_DROPLET "\xEF\x8C\x8D" // F30D
|
||||
#define ICON_MOISTURE "\xEF\x92\x93" // F493
|
||||
#define ICON_PLUG "\xEF\x93\xB7" // F4F7
|
||||
#define ICON_THERMOMETER_HALF "\xEF\x97\x8D" // F5CD
|
||||
#define ICON_THERMOMETER_HIGH "\xEF\x97\x8E" // F5CE
|
||||
#define ICON_THERMOMETER_LOW "\xEF\x97\x8F" // F5CF
|
||||
#define ICON_THERMOMETER_SNOW "\xEF\x97\x90" // F5D0
|
||||
#define ICON_THERMOMETER_SUN "\xEF\x97\x91" // F5D1
|
||||
#define ICON_THERMOMETER "\xEF\x97\x92" // F5D2
|
||||
#define ICON_SHUTTER "\xEF\x84\x80" // F100
|
||||
#define ICON_MENU_LINES "\xEF\x91\xB9" // F479
|
||||
#define ICON_MENU_DOTS_H "\xEF\x97\x94" // F5D4
|
||||
#define ICON_MENU_DOTS_V "\xEF\x97\x93" // F5D3
|
||||
#define ICON_ROTATE_CW "\xEF\x84\x96" // F116
|
||||
#define ICON_ROTATE_CC "\xEF\x84\x97" // F117
|
||||
#define ICON_GRAPH "\xEF\x8F\xB2" // F3F2
|
||||
#define ICON_ARROW_DOWN_FILL "\xEF\x88\xA9" // F229
|
||||
#define ICON_ARROW_DOWN "\xEF\x88\xAC" // F22C
|
||||
#define ICON_ARROW_UP_FILL "\xEF\x88\xB5" // F235
|
||||
#define ICON_ARROW_UP "\xEF\x88\xB8" // F238
|
||||
#define ICON_ARROW_LEFT_FILL "\xEF\x88\xAD" // F22D
|
||||
#define ICON_ARROW_LEFT "\xEF\x88\xB0" // F230
|
||||
#define ICON_ARROW_RIGHT_FILL "\xEF\x88\xB1" // F231
|
||||
#define ICON_ARROW_RIGHT "\xEF\x88\xB4" // F234
|
||||
|
||||
|
||||
/*-------------------------------
|
||||
* Symbols from montserrat font
|
||||
*-----------------------------*/
|
||||
//use this list for font generator:
|
||||
/*-------------------------------
|
||||
* Symbols from montserrat font
|
||||
*-----------------------------*/
|
||||
// use this list for font generator:
|
||||
/*
|
||||
0x20-0x7F,0x00B0-0xB4,0x2022,0xAB,0xBB-0xBE,0x3A9,0x3C0,0x2022
|
||||
µÄÖÜäöüß
|
||||
|
||||
*/
|
||||
|
||||
/*-------------------------------
|
||||
* Symbols from FontAwesome font
|
||||
*-----------------------------*/
|
||||
/*-------------------------------
|
||||
* Symbols from FontAwesome font
|
||||
*-----------------------------*/
|
||||
|
||||
/*In the font converter use this list as range:
|
||||
61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468,
|
||||
61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517,
|
||||
61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556,
|
||||
61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641,
|
||||
61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017,
|
||||
62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650
|
||||
/*In the font converter use this list as range:
|
||||
61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468,
|
||||
61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517,
|
||||
61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556,
|
||||
61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641,
|
||||
61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017,
|
||||
62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650
|
||||
*/
|
||||
|
||||
/* These symbols can be predefined in the lv_conf.h file.
|
||||
* If they are not predefined, they will use the following values
|
||||
*/
|
||||
|
||||
/* These symbols can be predefined in the lv_conf.h file.
|
||||
* If they are not predefined, they will use the following values
|
||||
*/
|
||||
#if !defined LV_SYMBOL_AUDIO
|
||||
#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_AUDIO
|
||||
#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_VIDEO
|
||||
#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_VIDEO
|
||||
#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_LIST
|
||||
#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_LIST
|
||||
#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_OK
|
||||
#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_OK
|
||||
#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_CLOSE
|
||||
#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_CLOSE
|
||||
#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_POWER
|
||||
#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_POWER
|
||||
#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_SETTINGS
|
||||
#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_SETTINGS
|
||||
#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_HOME
|
||||
#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_HOME
|
||||
#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_DOWNLOAD
|
||||
#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_DOWNLOAD
|
||||
#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_DRIVE
|
||||
#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_DRIVE
|
||||
#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_REFRESH
|
||||
#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_REFRESH
|
||||
#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_MUTE
|
||||
#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_MUTE
|
||||
#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_VOLUME_MID
|
||||
#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_VOLUME_MID
|
||||
#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_VOLUME_MAX
|
||||
#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_VOLUME_MAX
|
||||
#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_IMAGE
|
||||
#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_IMAGE
|
||||
#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_TINT
|
||||
#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_TINT
|
||||
#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_PREV
|
||||
#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_PREV
|
||||
#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_PLAY
|
||||
#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_PLAY
|
||||
#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_PAUSE
|
||||
#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_PAUSE
|
||||
#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_STOP
|
||||
#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_STOP
|
||||
#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_NEXT
|
||||
#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_NEXT
|
||||
#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_EJECT
|
||||
#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_EJECT
|
||||
#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_LEFT
|
||||
#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_LEFT
|
||||
#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_RIGHT
|
||||
#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_RIGHT
|
||||
#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_PLUS
|
||||
#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_PLUS
|
||||
#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_MINUS
|
||||
#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_MINUS
|
||||
#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_EYE_OPEN
|
||||
#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_EYE_OPEN
|
||||
#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_EYE_CLOSE
|
||||
#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_EYE_CLOSE
|
||||
#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_WARNING
|
||||
#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_WARNING
|
||||
#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_SHUFFLE
|
||||
#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_SHUFFLE
|
||||
#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_UP
|
||||
#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_UP
|
||||
#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_DOWN
|
||||
#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_DOWN
|
||||
#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_LOOP
|
||||
#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_LOOP
|
||||
#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_DIRECTORY
|
||||
#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_DIRECTORY
|
||||
#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_UPLOAD
|
||||
#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_UPLOAD
|
||||
#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_CALL
|
||||
#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_CALL
|
||||
#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_CUT
|
||||
#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_CUT
|
||||
#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_COPY
|
||||
#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_COPY
|
||||
#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_SAVE
|
||||
#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_SAVE
|
||||
#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BARS
|
||||
#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BARS
|
||||
#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_ENVELOPE
|
||||
#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_ENVELOPE
|
||||
#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_CHARGE
|
||||
#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_CHARGE
|
||||
#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_PASTE
|
||||
#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_PASTE
|
||||
#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BELL
|
||||
#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BELL
|
||||
#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_KEYBOARD
|
||||
#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_KEYBOARD
|
||||
#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_GPS
|
||||
#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_GPS
|
||||
#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_FILE
|
||||
#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_FILE
|
||||
#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_WIFI
|
||||
#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_WIFI
|
||||
#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BATTERY_FULL
|
||||
#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BATTERY_FULL
|
||||
#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BATTERY_3
|
||||
#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BATTERY_3
|
||||
#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BATTERY_2
|
||||
#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BATTERY_2
|
||||
#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BATTERY_1
|
||||
#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BATTERY_1
|
||||
#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BATTERY_EMPTY
|
||||
#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BATTERY_EMPTY
|
||||
#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_USB
|
||||
#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_USB
|
||||
#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BLUETOOTH
|
||||
#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BLUETOOTH
|
||||
#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_TRASH
|
||||
#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_TRASH
|
||||
#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_EDIT
|
||||
#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_EDIT
|
||||
#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_BACKSPACE
|
||||
#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_BACKSPACE
|
||||
#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_SD_CARD
|
||||
#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_SD_CARD
|
||||
#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_NEW_LINE
|
||||
#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_NEW_LINE
|
||||
#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/
|
||||
#endif
|
||||
#if !defined LV_SYMBOL_DUMMY
|
||||
/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will
|
||||
* show it as a label*/
|
||||
#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF"
|
||||
#endif
|
||||
|
||||
#if !defined LV_SYMBOL_DUMMY
|
||||
/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/
|
||||
#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_SYMBOL_DEF_H*/
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_SYMBOL_DEF_H*/
|
||||
|
||||
@ -163,7 +163,7 @@ void displayWake(){
|
||||
delay(50);
|
||||
|
||||
touch.setPins(TouchRST, TouchInt);
|
||||
Wire.begin(SDA,SCL); //初始化IIC,设置引脚 SCL:22 SDA:21
|
||||
Wire.begin(TouchSDA,TouchSCL); //初始化IIC,设置引脚 SCL:22 SDA:21
|
||||
Wire.setClock(200000); //设置频率400KHZ
|
||||
if(touch.begin(Wire, TouchI2CAddr, SDA, SCL)){
|
||||
Serial.println("Touch screen initialization done");
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
#define TouchInt 8
|
||||
#define TouchRST 9
|
||||
#define SCL 7
|
||||
#define SDA 6
|
||||
#define TouchSCL 7
|
||||
#define TouchSDA 6
|
||||
|
||||
#define TouchI2CAddr 0x15
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
bool history_initialized = false;
|
||||
|
||||
dataset_t glblData = {.temp = NAN, .hum = NAN, .pres = NAN, .seaLevelPress = NAN, .settemp= NAN, .heating=false, .enBuff =false, .relPowerSave=true, .presAlarm=false, .myIP={0}, .wifiStrength = WIFISTRENGTH_OFF, .wifiMode= WIFIMODE_OFF, .override = OVR_NONE, .bootTime = {0}};
|
||||
dataset_t glblData = {.temp = NAN, .hum = NAN, .pres = NAN, .seaLevelPress = NAN, .settemp= NAN, .outTemp = NAN, .heating=false, .enBuff =false, .relPowerSave=true, .presAlarm=false, .myIP={0}, .wifiStrength = WIFISTRENGTH_OFF, .wifiMode= WIFIMODE_OFF, .override = OVR_NONE, .bootTime = {0}};
|
||||
hist_t history = {{0},{0},{0}};
|
||||
|
||||
int32_t* history_getPressPt(void){
|
||||
|
||||
@ -52,6 +52,7 @@ typedef struct dataset_s{
|
||||
float pres;
|
||||
float seaLevelPress;
|
||||
float settemp;
|
||||
float outTemp;
|
||||
bool heating;
|
||||
bool enBuff;
|
||||
bool relPowerSave;
|
||||
|
||||
16
eez-project/src/ui/actions.h
Normal file
16
eez-project/src/ui/actions.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef EEZ_LVGL_UI_EVENTS_H
|
||||
#define EEZ_LVGL_UI_EVENTS_H
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_EVENTS_H*/
|
||||
16
eez-project/src/ui/fonts.h
Normal file
16
eez-project/src/ui/fonts.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef EEZ_LVGL_UI_FONTS_H
|
||||
#define EEZ_LVGL_UI_FONTS_H
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_FONTS_H*/
|
||||
5
eez-project/src/ui/images.c
Normal file
5
eez-project/src/ui/images.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include "images.h"
|
||||
|
||||
const ext_img_desc_t images[1] = {
|
||||
0
|
||||
};
|
||||
26
eez-project/src/ui/images.h
Normal file
26
eez-project/src/ui/images.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef EEZ_LVGL_UI_IMAGES_H
|
||||
#define EEZ_LVGL_UI_IMAGES_H
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EXT_IMG_DESC_T
|
||||
#define EXT_IMG_DESC_T
|
||||
typedef struct _ext_img_desc_t {
|
||||
const char *name;
|
||||
const lv_img_dsc_t *img_dsc;
|
||||
} ext_img_desc_t;
|
||||
#endif
|
||||
|
||||
extern const ext_img_desc_t images[1];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_IMAGES_H*/
|
||||
347
eez-project/src/ui/screens.c
Normal file
347
eez-project/src/ui/screens.c
Normal file
@ -0,0 +1,347 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "screens.h"
|
||||
#include "images.h"
|
||||
#include "fonts.h"
|
||||
#include "actions.h"
|
||||
#include "vars.h"
|
||||
#include "styles.h"
|
||||
#include "ui.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
objects_t objects;
|
||||
lv_obj_t *tick_value_change_obj;
|
||||
|
||||
void create_screen_rollo_pos() {
|
||||
lv_obj_t *obj = lv_obj_create(0);
|
||||
objects.rollo_pos = obj;
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, 240, 240);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_arc_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 88, 95);
|
||||
lv_obj_set_size(obj, 93, 87);
|
||||
lv_arc_set_range(obj, 0, 900);
|
||||
lv_arc_set_value(obj, 0);
|
||||
lv_arc_set_bg_start_angle(obj, 270);
|
||||
lv_arc_set_bg_end_angle(obj, 90);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_ADV_HITTEST);
|
||||
add_style_arc(obj);
|
||||
lv_obj_set_style_arc_width(obj, 4, LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_arc_width(obj, 4, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_slider_create(parent_obj);
|
||||
objects.obj0 = obj;
|
||||
lv_obj_set_pos(obj, 75, 68);
|
||||
lv_obj_set_size(obj, 3, 140);
|
||||
lv_slider_set_range(obj, 100, 0);
|
||||
lv_slider_set_value(obj, 50, LV_ANIM_OFF);
|
||||
add_style_slider(obj);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffa2f321), LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_bottom(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_left(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_right(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_top(obj, 6, LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_btn_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 10, 100);
|
||||
lv_obj_set_size(obj, 40, 40);
|
||||
add_style_button(obj);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "X");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_obj_create(parent_obj);
|
||||
objects.obj1 = obj;
|
||||
lv_obj_set_pos(obj, 99, 63);
|
||||
lv_obj_set_size(obj, 18, 150);
|
||||
lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_top(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_right(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE|LV_OBJ_FLAG_CLICK_FOCUSABLE|LV_OBJ_FLAG_GESTURE_BUBBLE|LV_OBJ_FLAG_PRESS_LOCK|LV_OBJ_FLAG_SCROLLABLE|LV_OBJ_FLAG_SCROLL_CHAIN_HOR|LV_OBJ_FLAG_SCROLL_CHAIN_VER|LV_OBJ_FLAG_SCROLL_ELASTIC|LV_OBJ_FLAG_SCROLL_MOMENTUM|LV_OBJ_FLAG_SCROLL_WITH_ARROW|LV_OBJ_FLAG_SNAPPABLE);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfffafafa), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(obj, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_color(obj, lv_color_hex(0xff000000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_radius(obj, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
// lam0
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam0 = obj;
|
||||
lv_obj_set_pos(obj, 7, 3);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_long_mode(obj, LV_LABEL_LONG_CLIP);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam1
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam1 = obj;
|
||||
lv_obj_set_pos(obj, 7, 19);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam2
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam2 = obj;
|
||||
lv_obj_set_pos(obj, 7, 35);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam3
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam3 = obj;
|
||||
lv_obj_set_pos(obj, 7, 51);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffffffff), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam4
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam4 = obj;
|
||||
lv_obj_set_pos(obj, 7, 67);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam5
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam5 = obj;
|
||||
lv_obj_set_pos(obj, 7, 83);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam6
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam6 = obj;
|
||||
lv_obj_set_pos(obj, 7, 99);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam7
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam7 = obj;
|
||||
lv_obj_set_pos(obj, 7, 115);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
// lam8
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
objects.lam8 = obj;
|
||||
lv_obj_set_pos(obj, 7, 131);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "(");
|
||||
lv_obj_set_style_transform_pivot_x(obj, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_pivot_y(obj, 7, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_transform_rotation(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_btn_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 193, 100);
|
||||
lv_obj_set_size(obj, 40, 40);
|
||||
add_style_button(obj);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "OK");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 49, 9);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "Endposition\n\"Fenster Rechts\"\nfür taste AUF speichern");
|
||||
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_12, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
tick_screen_rollo_pos();
|
||||
}
|
||||
|
||||
void tick_screen_rollo_pos() {
|
||||
}
|
||||
|
||||
void create_screen_menu() {
|
||||
lv_obj_t *obj = lv_obj_create(0);
|
||||
objects.menu = obj;
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, 240, 240);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_buttonmatrix_create(parent_obj);
|
||||
objects.obj2 = obj;
|
||||
lv_obj_set_pos(obj, 25, 25);
|
||||
lv_obj_set_size(obj, 190, 190);
|
||||
static const char *map[6] = {
|
||||
"Temp",
|
||||
"Historie",
|
||||
"\n",
|
||||
"Rollos",
|
||||
"Debug",
|
||||
NULL,
|
||||
};
|
||||
lv_buttonmatrix_set_map(obj, map);
|
||||
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff15171a), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
tick_screen_menu();
|
||||
}
|
||||
|
||||
void tick_screen_menu() {
|
||||
}
|
||||
|
||||
void create_screen_rollos() {
|
||||
lv_obj_t *obj = lv_obj_create(0);
|
||||
objects.rollos = obj;
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, 240, 240);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_dropdown_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 60, 20);
|
||||
lv_obj_set_size(obj, 120, LV_SIZE_CONTENT);
|
||||
lv_dropdown_set_options(obj, "Türe\nFenster\nBeide");
|
||||
lv_dropdown_set_selected(obj, 1);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_10, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_10, LV_PART_SELECTED | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_buttonmatrix_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 62, 59);
|
||||
lv_obj_set_size(obj, 145, 139);
|
||||
static const char *map[9] = {
|
||||
"^",
|
||||
"#",
|
||||
"\n",
|
||||
"STOP",
|
||||
"#",
|
||||
"\n",
|
||||
"\\/",
|
||||
"#",
|
||||
NULL,
|
||||
};
|
||||
static lv_buttonmatrix_ctrl_t ctrl_map[6] = {
|
||||
5,
|
||||
1,
|
||||
5,
|
||||
1,
|
||||
5,
|
||||
1,
|
||||
};
|
||||
lv_buttonmatrix_set_map(obj, map);
|
||||
lv_buttonmatrix_set_ctrl_map(obj, ctrl_map);
|
||||
lv_obj_set_style_pad_top(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_right(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(obj, 8, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_btn_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 4, 100);
|
||||
lv_obj_set_size(obj, 40, 40);
|
||||
add_style_button(obj);
|
||||
{
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_label_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_label_set_text(obj, "#");
|
||||
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tick_screen_rollos();
|
||||
}
|
||||
|
||||
void tick_screen_rollos() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef void (*tick_screen_func_t)();
|
||||
tick_screen_func_t tick_screen_funcs[] = {
|
||||
tick_screen_rollo_pos,
|
||||
tick_screen_menu,
|
||||
tick_screen_rollos,
|
||||
};
|
||||
void tick_screen(int screen_index) {
|
||||
tick_screen_funcs[screen_index]();
|
||||
}
|
||||
void tick_screen_by_id(enum ScreensEnum screenId) {
|
||||
tick_screen_funcs[screenId - 1]();
|
||||
}
|
||||
|
||||
void create_screens() {
|
||||
lv_disp_t *dispp = lv_disp_get_default();
|
||||
lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT);
|
||||
lv_disp_set_theme(dispp, theme);
|
||||
|
||||
create_screen_rollo_pos();
|
||||
create_screen_menu();
|
||||
create_screen_rollos();
|
||||
}
|
||||
55
eez-project/src/ui/screens.h
Normal file
55
eez-project/src/ui/screens.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef EEZ_LVGL_UI_SCREENS_H
|
||||
#define EEZ_LVGL_UI_SCREENS_H
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _objects_t {
|
||||
lv_obj_t *rollo_pos;
|
||||
lv_obj_t *menu;
|
||||
lv_obj_t *rollos;
|
||||
lv_obj_t *obj0;
|
||||
lv_obj_t *obj1;
|
||||
lv_obj_t *lam0;
|
||||
lv_obj_t *lam1;
|
||||
lv_obj_t *lam2;
|
||||
lv_obj_t *lam3;
|
||||
lv_obj_t *lam4;
|
||||
lv_obj_t *lam5;
|
||||
lv_obj_t *lam6;
|
||||
lv_obj_t *lam7;
|
||||
lv_obj_t *lam8;
|
||||
lv_obj_t *obj2;
|
||||
} objects_t;
|
||||
|
||||
extern objects_t objects;
|
||||
|
||||
enum ScreensEnum {
|
||||
SCREEN_ID_ROLLO_POS = 1,
|
||||
SCREEN_ID_MENU = 2,
|
||||
SCREEN_ID_ROLLOS = 3,
|
||||
};
|
||||
|
||||
void create_screen_rollo_pos();
|
||||
void tick_screen_rollo_pos();
|
||||
|
||||
void create_screen_menu();
|
||||
void tick_screen_menu();
|
||||
|
||||
void create_screen_rollos();
|
||||
void tick_screen_rollos();
|
||||
|
||||
void tick_screen_by_id(enum ScreensEnum screenId);
|
||||
void tick_screen(int screen_index);
|
||||
|
||||
void create_screens();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_SCREENS_H*/
|
||||
22
eez-project/src/ui/structs.h
Normal file
22
eez-project/src/ui/structs.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef EEZ_LVGL_UI_STRUCTS_H
|
||||
#define EEZ_LVGL_UI_STRUCTS_H
|
||||
|
||||
|
||||
|
||||
#if defined(EEZ_FOR_LVGL)
|
||||
|
||||
#include <eez/flow/flow.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "vars.h"
|
||||
|
||||
using namespace eez;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_STRUCTS_H*/
|
||||
144
eez-project/src/ui/styles.c
Normal file
144
eez-project/src/ui/styles.c
Normal file
@ -0,0 +1,144 @@
|
||||
#include "styles.h"
|
||||
#include "images.h"
|
||||
#include "fonts.h"
|
||||
|
||||
#include "ui.h"
|
||||
#include "screens.h"
|
||||
|
||||
//
|
||||
// Style: Button
|
||||
//
|
||||
|
||||
void init_style_button_MAIN_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xff2f3237));
|
||||
};
|
||||
|
||||
lv_style_t *get_style_button_MAIN_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_button_MAIN_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void add_style_button(lv_obj_t *obj) {
|
||||
lv_obj_add_style(obj, get_style_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
void remove_style_button(lv_obj_t *obj) {
|
||||
lv_obj_remove_style(obj, get_style_button_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
//
|
||||
// Style: arc
|
||||
//
|
||||
|
||||
void init_style_arc_INDICATOR_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_arc_color(style, lv_color_hex(0xff56f321));
|
||||
};
|
||||
|
||||
lv_style_t *get_style_arc_INDICATOR_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_arc_INDICATOR_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void init_style_arc_KNOB_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xffa2f321));
|
||||
};
|
||||
|
||||
lv_style_t *get_style_arc_KNOB_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_arc_KNOB_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void add_style_arc(lv_obj_t *obj) {
|
||||
lv_obj_add_style(obj, get_style_arc_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
lv_obj_add_style(obj, get_style_arc_KNOB_DEFAULT(), LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
void remove_style_arc(lv_obj_t *obj) {
|
||||
lv_obj_remove_style(obj, get_style_arc_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
lv_obj_remove_style(obj, get_style_arc_KNOB_DEFAULT(), LV_PART_KNOB | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
//
|
||||
// Style: slider
|
||||
//
|
||||
|
||||
void init_style_slider_MAIN_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xff2f3237));
|
||||
lv_style_set_bg_opa(style, 255);
|
||||
};
|
||||
|
||||
lv_style_t *get_style_slider_MAIN_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_slider_MAIN_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void init_style_slider_INDICATOR_DEFAULT(lv_style_t *style) {
|
||||
lv_style_set_bg_color(style, lv_color_hex(0xff56f321));
|
||||
lv_style_set_shadow_width(style, 10);
|
||||
lv_style_set_shadow_color(style, lv_color_hex(0xff56f321));
|
||||
};
|
||||
|
||||
lv_style_t *get_style_slider_INDICATOR_DEFAULT() {
|
||||
static lv_style_t *style;
|
||||
if (!style) {
|
||||
style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init(style);
|
||||
init_style_slider_INDICATOR_DEFAULT(style);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
void add_style_slider(lv_obj_t *obj) {
|
||||
lv_obj_add_style(obj, get_style_slider_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_add_style(obj, get_style_slider_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
void remove_style_slider(lv_obj_t *obj) {
|
||||
lv_obj_remove_style(obj, get_style_slider_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_remove_style(obj, get_style_slider_INDICATOR_DEFAULT(), LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
void add_style(lv_obj_t *obj, int32_t styleIndex) {
|
||||
typedef void (*AddStyleFunc)(lv_obj_t *obj);
|
||||
static const AddStyleFunc add_style_funcs[] = {
|
||||
add_style_button,
|
||||
add_style_arc,
|
||||
add_style_slider,
|
||||
};
|
||||
add_style_funcs[styleIndex](obj);
|
||||
}
|
||||
|
||||
void remove_style(lv_obj_t *obj, int32_t styleIndex) {
|
||||
typedef void (*RemoveStyleFunc)(lv_obj_t *obj);
|
||||
static const RemoveStyleFunc remove_style_funcs[] = {
|
||||
remove_style_button,
|
||||
remove_style_arc,
|
||||
remove_style_slider,
|
||||
};
|
||||
remove_style_funcs[styleIndex](obj);
|
||||
}
|
||||
|
||||
33
eez-project/src/ui/styles.h
Normal file
33
eez-project/src/ui/styles.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef EEZ_LVGL_UI_STYLES_H
|
||||
#define EEZ_LVGL_UI_STYLES_H
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Style: Button
|
||||
lv_style_t *get_style_button_MAIN_DEFAULT();
|
||||
void add_style_button(lv_obj_t *obj);
|
||||
void remove_style_button(lv_obj_t *obj);
|
||||
|
||||
// Style: arc
|
||||
lv_style_t *get_style_arc_INDICATOR_DEFAULT();
|
||||
lv_style_t *get_style_arc_KNOB_DEFAULT();
|
||||
void add_style_arc(lv_obj_t *obj);
|
||||
void remove_style_arc(lv_obj_t *obj);
|
||||
|
||||
// Style: slider
|
||||
lv_style_t *get_style_slider_MAIN_DEFAULT();
|
||||
lv_style_t *get_style_slider_INDICATOR_DEFAULT();
|
||||
void add_style_slider(lv_obj_t *obj);
|
||||
void remove_style_slider(lv_obj_t *obj);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_STYLES_H*/
|
||||
56
eez-project/src/ui/ui.c
Normal file
56
eez-project/src/ui/ui.c
Normal file
@ -0,0 +1,56 @@
|
||||
#if defined(EEZ_FOR_LVGL)
|
||||
#include <eez/core/vars.h>
|
||||
#endif
|
||||
|
||||
#include "ui.h"
|
||||
#include "screens.h"
|
||||
#include "images.h"
|
||||
#include "actions.h"
|
||||
#include "vars.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(EEZ_FOR_LVGL)
|
||||
|
||||
void ui_init() {
|
||||
eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);
|
||||
}
|
||||
|
||||
void ui_tick() {
|
||||
eez_flow_tick();
|
||||
tick_screen(g_currentScreen);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static int16_t currentScreen = -1;
|
||||
|
||||
static lv_obj_t *getLvglObjectFromIndex(int32_t index) {
|
||||
if (index == -1) {
|
||||
return 0;
|
||||
}
|
||||
return ((lv_obj_t **)&objects)[index];
|
||||
}
|
||||
|
||||
void loadScreen(enum ScreensEnum screenId) {
|
||||
currentScreen = screenId - 1;
|
||||
lv_obj_t *screen = getLvglObjectFromIndex(currentScreen);
|
||||
lv_scr_load_anim(screen, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
|
||||
}
|
||||
|
||||
void ui_init() {
|
||||
create_screens();
|
||||
undefined
|
||||
}
|
||||
|
||||
void ui_tick() {
|
||||
tick_screen(currentScreen);
|
||||
}
|
||||
|
||||
#endif
|
||||
33
eez-project/src/ui/ui.h
Normal file
33
eez-project/src/ui/ui.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef EEZ_LVGL_UI_GUI_H
|
||||
#define EEZ_LVGL_UI_GUI_H
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
|
||||
|
||||
#if defined(EEZ_FOR_LVGL)
|
||||
#include <eez/flow/lvgl_api.h>
|
||||
#endif
|
||||
|
||||
#if !defined(EEZ_FOR_LVGL)
|
||||
#include "screens.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void ui_init();
|
||||
void ui_tick();
|
||||
|
||||
#if !defined(EEZ_FOR_LVGL)
|
||||
void loadScreen(enum ScreensEnum screenId);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // EEZ_LVGL_UI_GUI_H
|
||||
29
eez-project/src/ui/vars.h
Normal file
29
eez-project/src/ui/vars.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef EEZ_LVGL_UI_VARS_H
|
||||
#define EEZ_LVGL_UI_VARS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// enum declarations
|
||||
|
||||
|
||||
|
||||
// Flow global variables
|
||||
|
||||
enum FlowGlobalVariables {
|
||||
FLOW_GLOBAL_VARIABLE_NONE
|
||||
};
|
||||
|
||||
// Native global variables
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*EEZ_LVGL_UI_VARS_H*/
|
||||
1539
eez-project/test.eez-project
Normal file
1539
eez-project/test.eez-project
Normal file
File diff suppressed because it is too large
Load Diff
1092
eez-project/test.eez-project-ui-state
Normal file
1092
eez-project/test.eez-project-ui-state
Normal file
File diff suppressed because it is too large
Load Diff
1133
test/test/test.eez-project
Normal file
1133
test/test/test.eez-project
Normal file
File diff suppressed because it is too large
Load Diff
1057
test/test/test.eez-project-ui-state
Normal file
1057
test/test/test.eez-project-ui-state
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user