Skip to content

Commit cd37691

Browse files
committed
Initial Support
Removed old libraries, initial GUI based on LVGL.
1 parent 9948fc4 commit cd37691

File tree

169 files changed

+18407
-1792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+18407
-1792
lines changed

.gitmodules

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
[submodule "components/arduino-esp32"]
22
path = components/arduino-esp32
33
url = https://github.com/sieren/arduino-esp32.git
4-
[submodule "main/libraries/TFT_eFEX"]
5-
path = main/libraries/TFT_eFEX
6-
url = https://github.com/sieren/TFT_eFEX.git
74
[submodule "main/libraries/rapidjson"]
85
path = main/libraries/rapidjson
96
url = https://github.com/Tencent/rapidjson.git
10-
[submodule "main/libraries/JPEGDecoder"]
11-
path = main/libraries/JPEGDecoder
12-
url = https://github.com/sieren/JPEGDecoder.git
137
[submodule "components/ESPAsyncWebServer"]
148
path = components/ESPAsyncWebServer
159
url = https://github.com/me-no-dev/ESPAsyncWebServer.git
1610
[submodule "components/AsyncTCP"]
1711
path = components/AsyncTCP
1812
url = https://github.com/me-no-dev/AsyncTCP.git
19-
[submodule "main/libraries/TFT_eSPI"]
20-
path = main/libraries/TFT_eSPI
21-
url = https://github.com/Bodmer/TFT_eSPI.git
13+
[submodule "components/lvgl_esp32_drivers"]
14+
path = components/lvgl_esp32_drivers
15+
url = https://github.com/usedbytes/lvgl_esp32_drivers.git
16+
[submodule "components/lvgl"]
17+
path = components/lvgl
18+
url = https://github.com/lvgl/lvgl.git
19+
[submodule "components/axp192"]
20+
path = components/axp192
21+
url = https://github.com/usedbytes/axp192.git
22+
[submodule "components/esp_i2c_helper"]
23+
path = components/esp_i2c_helper
24+
url = https://github.com/tuupola/esp_i2c_helper.git

.vscode/settings.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"files.associations": {
3+
"__bit_reference": "cpp",
4+
"__config": "cpp",
5+
"__debug": "cpp",
6+
"__errc": "cpp",
7+
"__functional_base": "cpp",
8+
"__hash_table": "cpp",
9+
"__locale": "cpp",
10+
"__mutex_base": "cpp",
11+
"__node_handle": "cpp",
12+
"__nullptr": "cpp",
13+
"__split_buffer": "cpp",
14+
"__string": "cpp",
15+
"__threading_support": "cpp",
16+
"__tree": "cpp",
17+
"__tuple": "cpp",
18+
"algorithm": "cpp",
19+
"array": "cpp",
20+
"atomic": "cpp",
21+
"bit": "cpp",
22+
"bitset": "cpp",
23+
"cctype": "cpp",
24+
"chrono": "cpp",
25+
"clocale": "cpp",
26+
"cmath": "cpp",
27+
"codecvt": "cpp",
28+
"complex": "cpp",
29+
"condition_variable": "cpp",
30+
"csignal": "cpp",
31+
"cstdarg": "cpp",
32+
"cstddef": "cpp",
33+
"cstdint": "cpp",
34+
"cstdio": "cpp",
35+
"cstdlib": "cpp",
36+
"cstring": "cpp",
37+
"ctime": "cpp",
38+
"cwchar": "cpp",
39+
"cwctype": "cpp",
40+
"deque": "cpp",
41+
"exception": "cpp",
42+
"coroutine": "cpp",
43+
"forward_list": "cpp",
44+
"fstream": "cpp",
45+
"functional": "cpp",
46+
"future": "cpp",
47+
"initializer_list": "cpp",
48+
"iomanip": "cpp",
49+
"ios": "cpp",
50+
"iosfwd": "cpp",
51+
"iostream": "cpp",
52+
"istream": "cpp",
53+
"iterator": "cpp",
54+
"limits": "cpp",
55+
"list": "cpp",
56+
"locale": "cpp",
57+
"map": "cpp",
58+
"memory": "cpp",
59+
"mutex": "cpp",
60+
"new": "cpp",
61+
"numeric": "cpp",
62+
"optional": "cpp",
63+
"ostream": "cpp",
64+
"queue": "cpp",
65+
"random": "cpp",
66+
"ratio": "cpp",
67+
"regex": "cpp",
68+
"set": "cpp",
69+
"shared_mutex": "cpp",
70+
"sstream": "cpp",
71+
"stack": "cpp",
72+
"stdexcept": "cpp",
73+
"streambuf": "cpp",
74+
"string": "cpp",
75+
"string_view": "cpp",
76+
"system_error": "cpp",
77+
"thread": "cpp",
78+
"tuple": "cpp",
79+
"type_traits": "cpp",
80+
"typeinfo": "cpp",
81+
"unordered_map": "cpp",
82+
"unordered_set": "cpp",
83+
"utility": "cpp",
84+
"variant": "cpp",
85+
"vector": "cpp",
86+
"*.tcc": "cpp",
87+
"memory_resource": "cpp",
88+
"netfwd": "cpp",
89+
"cinttypes": "cpp",
90+
"filesystem": "cpp",
91+
"ranges": "cpp"
92+
}
93+
}

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
66
set(CMAKE_CXX_STANDARD 17)
77
list(APPEND compile_definitions "ARDUINO=202000")
88

9-
109
# Ignore warning in Azure IoT Library in esp32 Arduino
1110
# pending PR: https://github.com/VSChina/ESP32_AzureIoT_Arduino/pull/15
1211
list(APPEND compile_options "-Wno-maybe-uninitialized")
12+
list(APPEND EXTRA_COMPONENT_DIRS components/lvgl_esp32_drivers components/lvgl_esp32_drivers/lvgl_touch components/lvgl_esp32_drivers/lvgl_tft)
13+
1314

1415
project(homepoint)

HomeControl.code-workspace

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,28 @@
6262
"streambuf": "cpp",
6363
"system_error": "cpp",
6464
"thread": "cpp",
65-
"cinttypes": "cpp"
65+
"cinttypes": "cpp",
66+
"bit": "cpp",
67+
"bitset": "cpp",
68+
"compare": "cpp",
69+
"complex": "cpp",
70+
"concepts": "cpp",
71+
"map": "cpp",
72+
"memory_resource": "cpp",
73+
"netfwd": "cpp",
74+
"random": "cpp",
75+
"regex": "cpp",
76+
"string": "cpp",
77+
"iomanip": "cpp",
78+
"iostream": "cpp",
79+
"ranges": "cpp",
80+
"shared_mutex": "cpp",
81+
"stop_token": "cpp",
82+
"variant": "cpp",
83+
"forward_list": "cpp",
84+
"set": "cpp",
85+
"unordered_set": "cpp",
86+
"*.ipp": "cpp"
6687
}
6788
}
6889
}

components/.DS_Store

0 Bytes
Binary file not shown.

components/axp192

Submodule axp192 added at 99acd4a

components/esp_i2c_helper

Submodule esp_i2c_helper added at 6191d4a

components/lvgl

Submodule lvgl added at 0bdcf36

components/lvgl_esp32_drivers

Submodule lvgl_esp32_drivers added at 347aaa6

data/arrow_left.jpg

-8.91 KB
Binary file not shown.

data/arrow_right.jpg

-8.92 KB
Binary file not shown.

data/bedroom_active.jpg

-10.2 KB
Binary file not shown.

data/bedroom_inactive.jpg

-9.79 KB
Binary file not shown.

data/door_active.jpg

-13.2 KB
Binary file not shown.

data/door_inactive.jpg

-12.6 KB
Binary file not shown.

data/exitbutton.bin

1.29 KB
Binary file not shown.

data/fan_active.jpg

-13.1 KB
Binary file not shown.

data/fan_inactive.jpg

-12.7 KB
Binary file not shown.

data/fountain_active.jpg

-10.1 KB
Binary file not shown.

data/fountain_inactive.jpg

-9.79 KB
Binary file not shown.

data/garden_active.jpg

-9.32 KB
Binary file not shown.

data/garden_inactive.jpg

-9.25 KB
Binary file not shown.

data/humidity_small.bin

394 Bytes
Binary file not shown.

data/humidity_small.jpg

-9.15 KB
Binary file not shown.

data/kitchen_active.jpg

-10.1 KB
Binary file not shown.

data/kitchen_inactive.jpg

-10 KB
Binary file not shown.

data/livingroom_active.jpg

-11.6 KB
Binary file not shown.

data/livingroom_inactive.jpg

-10.6 KB
Binary file not shown.

data/mqtt_off.jpg

-8.5 KB
Binary file not shown.

data/mqtt_on.jpg

-8.47 KB
Binary file not shown.

data/night_active.jpg

-9.64 KB
Binary file not shown.

data/night_inactive.jpg

-9.46 KB
Binary file not shown.

data/power_active.jpg

-10.6 KB
Binary file not shown.

data/power_inactive.jpg

-10.4 KB
Binary file not shown.

data/temperature_small.bin

394 Bytes
Binary file not shown.

data/temperature_small.jpg

-9.13 KB
Binary file not shown.

data/voc_small.bin

394 Bytes
Binary file not shown.

data/voc_small.jpg

-13.1 KB
Binary file not shown.

data/wattage_small.bin

394 Bytes
Binary file not shown.

data/wattage_small.jpg

-1.07 KB
Binary file not shown.

data/wifi_off.jpg

-8.56 KB
Binary file not shown.

data/wifi_on.jpg

-8.48 KB
Binary file not shown.

main/AppContext.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace ctx
88
void AppContext::setup()
99
{
1010
fs::FileSystem::getInstance().loadPartitions();
11+
mpWifiContext = std::make_shared<WifiContext>();
1112
try
1213
{
1314
mModel = fs::ConfigReader().readConfiguration();
@@ -30,9 +31,11 @@ namespace ctx
3031
if (cb == mqtt::MQTTConnectionStatus::CONNECTED)
3132
{
3233
mpMQTTConnection->bindScenes();
34+
mAppStateNotifier.broadcast(ContextState::Ready);
3335
}
3436
});
3537
mpWebServer = std::make_unique<web::WebServer>(shared_from_this(), mModel.mWebCredentials);
38+
mAppStateNotifier.broadcast(ContextState::Ready);
3639
}
3740

3841
void AppContext::reload()
@@ -52,10 +55,11 @@ namespace ctx
5255
if (cb == mqtt::MQTTConnectionStatus::CONNECTED)
5356
{
5457
mpMQTTConnection->bindScenes();
58+
mAppStateNotifier.broadcast(ContextState::Ready);
5559
}
60+
Serial.println("Connected");
5661
});
5762
mpMQTTConnection->connect();
58-
mAppStateNotifier.broadcast(ContextState::Ready);
5963
}
6064

6165
void AppContext::setFirstLaunch(const WifiCredentials credentials,
@@ -65,17 +69,22 @@ namespace ctx
6569
ESP.restart();
6670
}
6771

68-
void AppContext::registerStateCallback(AppStateCB callback)
72+
Dispatcher<ctx::ContextState>::CBID AppContext::registerStateCallback(AppStateCB callback)
73+
{
74+
return mAppStateNotifier.addCB(callback);
75+
}
76+
77+
void AppContext::deleteStateCallback(Dispatcher<ctx::ContextState>::CBID callback)
6978
{
70-
mAppStateNotifier.addCB(callback);
79+
mAppStateNotifier.delCB(callback);
7180
}
7281

7382
void AppContext::connectWireless()
7483
{
7584
auto& wifi = mModel.mWifiCredentials;
76-
getWifiContext().connect(wifi.mSSID, wifi.mPassword, wifi.mHostname);
85+
mpWifiContext->connect(wifi.mSSID, wifi.mPassword, wifi.mHostname);
7786
using namespace std::placeholders;
78-
getWifiContext().registerCallback(std::bind(&AppContext::connectionStateChanged, this, _1));
87+
mpWifiContext->registerCallback(std::bind(&AppContext::connectionStateChanged, this, _1));
7988
}
8089

8190
std::vector<MQTTVariants> &AppContext::getMQTTGroups()

main/AppContext.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ namespace ctx
2828
AppContext() = default;
2929
void setup();
3030

31-
WifiContext& getWifiContext() { return mWifiContext; };
31+
std::shared_ptr<WifiContext> getWifiContext() { return mpWifiContext; };
3232
model::Model& getModel() { return mModel; }
3333
std::shared_ptr<mqtt::MQTTConnection> getMQTTConnection() { return mpMQTTConnection; };
3434
std::vector<MQTTVariants> &getMQTTGroups();
3535
void reload();
3636
void connectionStateChanged(ctx::WifiConnectionState state);
3737
void setFirstLaunch(const WifiCredentials credentials,
3838
const std::string login, const std::string username);
39-
void registerStateCallback(AppStateCB callback);
39+
Dispatcher<ctx::ContextState>::CBID registerStateCallback(AppStateCB callback);
40+
void deleteStateCallback(Dispatcher<ctx::ContextState>::CBID callback);
4041

4142
private:
4243
void connectWireless();
@@ -45,7 +46,7 @@ namespace ctx
4546
std::shared_ptr<ntp::NTPSync> mNTPSync;
4647
std::unique_ptr<wifi::CaptiveServer> mpCaptiveServer;
4748
std::unique_ptr<web::WebServer> mpWebServer;
48-
WifiContext mWifiContext;
49+
std::shared_ptr<WifiContext> mpWifiContext;
4950
rapidjson::Document mConfigDocument;
5051
model::Model mModel;
5152
};

0 commit comments

Comments
 (0)