Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/clangcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check
uses: jidicula/clang-format-action@v4.10.2
uses: jidicula/clang-format-action@v4.15.0
with:
clang-format-version: '15'
clang-format-version: '18'
check-path: 'main'
exclude-regex: '(main/lv_conf.h|main/hardware/sensors/sps30/*)'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ managed_components/
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.cache/
node_modules
sdcard/
main/generated/
Expand Down
56 changes: 28 additions & 28 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"configurations": [
{
"name": "ESP-IDF",
"compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}/**"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
},
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
"configurations": [
{
"name": "ESP-IDF",
"compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}/**"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
},
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
211 changes: 107 additions & 104 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,105 +1,108 @@
{
"idf.adapterTargetName": "esp32s3",
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
],
"idf.portWin": "COM4",
"idf.flashType": "UART",
"files.associations": {
"sdkconfig.h": "c",
"array": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"string_view": "cpp",
"initializer_list": "cpp",
"regex": "cpp",
"lvgl.h": "c",
"esp_attr.h": "c",
"stdint.h": "c",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"map": "cpp",
"set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"random": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"optional": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"netfwd": "cpp",
"locale": "cpp",
"charconv": "cpp",
"string.h": "c",
"sps30.h": "c",
"hardware.h": "c",
"source_location": "cpp",
"span": "cpp",
"esp_heap_caps.h": "c",
"esp_httpd_priv.h": "c",
"esp_system.h": "c",
"hap.h": "c",
"ui.h": "c",
"sps30_sensor_device.h": "c",
"csetjmp": "cpp",
"unordered_set": "cpp",
"esp_http_server.h": "c",
"sht3x_sensor_device.h": "c",
"scd4x_sensor_device.h": "c"
},
"C_Cpp.errorSquiggles": "disabled",
"editor.formatOnSave": true,
"idf.port": "/dev/ttyACM0",
"idf.customExtraVars": {
"IDF_TARGET": "esp32s3"
}
}
"idf.adapterTargetName": "esp32s3",
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
],
"idf.portWin": "COM4",
"idf.flashType": "UART",
"files.associations": {
"sdkconfig.h": "c",
"array": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"string_view": "cpp",
"initializer_list": "cpp",
"regex": "cpp",
"lvgl.h": "c",
"esp_attr.h": "c",
"stdint.h": "c",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"map": "cpp",
"set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"random": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"optional": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"netfwd": "cpp",
"locale": "cpp",
"charconv": "cpp",
"string.h": "c",
"sps30.h": "c",
"hardware.h": "c",
"source_location": "cpp",
"span": "cpp",
"esp_heap_caps.h": "c",
"esp_httpd_priv.h": "c",
"esp_system.h": "c",
"hap.h": "c",
"ui.h": "c",
"sps30_sensor_device.h": "c",
"csetjmp": "cpp",
"unordered_set": "cpp",
"esp_http_server.h": "c",
"sht3x_sensor_device.h": "c",
"scd4x_sensor_device.h": "c"
},
"C_Cpp.errorSquiggles": "disabled",
"editor.formatOnSave": true,
"idf.port": "/dev/ttyACM0",
"idf.espIdfPath": "/home/deepak/esp/v5.1.6/esp-idf",
"idf.toolsPath": "/home/deepak/.espressif",
"idf.pythonInstallPath": "/usr/bin/python3",
"idf.customExtraVars": {
"IDF_TARGET": "esp32s3"
}
}
6 changes: 3 additions & 3 deletions dependencies.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
dependencies:
bblanchon/arduinojson:
component_hash: 463812931f99cb7a554d64311288f537b43daaca3eed2427557b907af393447c
component_hash: b1c2f0b0bc26969af19809cee80b220fb882481d59cc75f8e79ebceecdc69f06
dependencies: []
source:
registry_url: https://components.espressif.com/
type: service
version: 6.21.5
version: 7.4.2
espressif/libsodium:
component_hash: 25b968723c584a2742ca36cebe5a7ef049c6767e059f7b1e1eec69946019025d
dependencies:
Expand Down Expand Up @@ -35,6 +35,6 @@ direct_dependencies:
- espressif/libsodium
- espressif/mdns
- idf
manifest_hash: dfded1dd19fea724069aaac4a789898b4f422c5dcf359824b719ce17f97737e5
manifest_hash: 18c4389e26bede534e89973aa65e1f4d95266bcc7cea5cd7d7cdb1a74c064fde
target: esp32s3
version: 2.0.0
21 changes: 10 additions & 11 deletions main/hardware/sensors/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,20 +278,19 @@ constexpr std::array<sensor_definition_display, 6> co2_definition_display{

#endif

constexpr std::array<sensor_definition, total_sensors> sensor_definitions
{
constexpr std::array<sensor_definition, total_sensors> sensor_definitions{
sensor_definition{"PM 2.5", "µg/m³", pm_2_5_definition_display.data(), pm_2_5_definition_display.size(), 0, 1000, 1},
sensor_definition{"Temperature", "°F", no_level.data(), no_level.size(), -40, 140, 1},
sensor_definition{"Temperature", "°C", no_level.data(), no_level.size(), -40, 70, 0.1},
sensor_definition{"Humidity", "⁒", no_level.data(), no_level.size(), 0, 100, 1},
sensor_definition{"Temperature", "°F", no_level.data(), no_level.size(), -40, 140, 1},
sensor_definition{"Temperature", "°C", no_level.data(), no_level.size(), -40, 70, 0.1},
sensor_definition{"Humidity", "⁒", no_level.data(), no_level.size(), 0, 100, 1},
#if defined CONFIG_SCD30_SENSOR_ENABLE || defined CONFIG_SCD4x_SENSOR_ENABLE
sensor_definition{"CO2", "ppm", co2_definition_display.data(), co2_definition_display.size(), 0, 2000, 1},
sensor_definition{"CO2", "ppm", co2_definition_display.data(), co2_definition_display.size(), 0, 2000, 1},
#endif
sensor_definition{"PM 1", "µg/m³", no_level.data(), no_level.size(), 0, 1000, 1},
sensor_definition{"PM 4", "µg/m³", no_level.data(), no_level.size(), 0, 1000, 1},
sensor_definition{"PM 10", "µg/m³", pm_10_definition_display.data(), pm_10_definition_display.size(), 0, 1000, 1},
sensor_definition{"Typical Particle Size", "µg", no_level.data(), no_level.size(), 0, 10, 0.1},
sensor_definition{"Light Intensity", "lux", no_level.data(), no_level.size(), 0, 65535, 1},
sensor_definition{"PM 1", "µg/m³", no_level.data(), no_level.size(), 0, 1000, 1},
sensor_definition{"PM 4", "µg/m³", no_level.data(), no_level.size(), 0, 1000, 1},
sensor_definition{"PM 10", "µg/m³", pm_10_definition_display.data(), pm_10_definition_display.size(), 0, 1000, 1},
sensor_definition{"Typical Particle Size", "µg", no_level.data(), no_level.size(), 0, 10, 0.1},
sensor_definition{"Light Intensity", "lux", no_level.data(), no_level.size(), 0, 65535, 1},
};

constexpr auto &&get_sensor_definition(sensor_id_index id)
Expand Down
12 changes: 5 additions & 7 deletions main/homekit/homekit_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ struct homekit_definition

constexpr auto homekit_definitions = std::to_array<homekit_definition>({
homekit_definition{sensor_id_index::pm_2_5, HAP_SERV_UUID_AIR_QUALITY_SENSOR, HAP_CHAR_UUID_PM_2_5_DENSITY, std::string_view()},
homekit_definition{sensor_id_index::temperatureC, HAP_SERV_UUID_TEMPERATURE_SENSOR, HAP_CHAR_UUID_CURRENT_TEMPERATURE, HAP_CHAR_UNIT_CELSIUS},
homekit_definition{sensor_id_index::humidity, HAP_SERV_UUID_HUMIDITY_SENSOR, HAP_CHAR_UUID_CURRENT_RELATIVE_HUMIDITY,
HAP_CHAR_UNIT_PERCENTAGE},
homekit_definition{sensor_id_index::pm_10, HAP_SERV_UUID_AIR_QUALITY_SENSOR, HAP_CHAR_UUID_PM_10_DENSITY, std::string_view()},
homekit_definition{sensor_id_index::light_intensity, HAP_SERV_UUID_LIGHT_SENSOR, HAP_CHAR_UUID_CURRENT_AMBIENT_LIGHT_LEVEL,
HAP_CHAR_UNIT_LUX},
homekit_definition{sensor_id_index::temperatureC, HAP_SERV_UUID_TEMPERATURE_SENSOR, HAP_CHAR_UUID_CURRENT_TEMPERATURE, HAP_CHAR_UNIT_CELSIUS},
homekit_definition{sensor_id_index::humidity, HAP_SERV_UUID_HUMIDITY_SENSOR, HAP_CHAR_UUID_CURRENT_RELATIVE_HUMIDITY, HAP_CHAR_UNIT_PERCENTAGE},
homekit_definition{sensor_id_index::pm_10, HAP_SERV_UUID_AIR_QUALITY_SENSOR, HAP_CHAR_UUID_PM_10_DENSITY, std::string_view()},
homekit_definition{sensor_id_index::light_intensity, HAP_SERV_UUID_LIGHT_SENSOR, HAP_CHAR_UUID_CURRENT_AMBIENT_LIGHT_LEVEL, HAP_CHAR_UNIT_LUX},
#if defined CONFIG_SCD30_SENSOR_ENABLE || defined CONFIG_SCD4x_SENSOR_ENABLE
homekit_definition{sensor_id_index::CO2, HAP_SERV_UUID_AIR_QUALITY_SENSOR, HAP_CHAR_UUID_CARBON_DIOXIDE_LEVEL, std::string_view()},
homekit_definition{sensor_id_index::CO2, HAP_SERV_UUID_CARBON_DIOXIDE_SENSOR, HAP_CHAR_UUID_CARBON_DIOXIDE_LEVEL, std::string_view()},
#endif
});

Expand Down
7 changes: 4 additions & 3 deletions main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## IDF Component Manager Manifest File
dependencies:
bblanchon/arduinojson: "^6.21.3"
## Required IDF version
idf:
version: ">=4.1.0"
version: '>=4.1.0'
# # Put list of dependencies here
# # For components maintained by Espressif:
# component: "~1.0.0"
Expand All @@ -14,4 +13,6 @@ dependencies:
# # For transient dependencies `public` flag can be set.
# # `public` flag doesn't have an effect dependencies of the `main` component.
# # All dependencies of `main` are public by default.
# public: true
# public: true
espressif/libsodium: ^1.0.20~2
bblanchon/arduinojson: ^7.4.2