Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #43

Merged
merged 2 commits into from
Jan 30, 2024
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
10 changes: 9 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ gulp.task('display-fonts-big-font-dual', function() {
'big_panel_font_dual.c', '--symbols="0,1,2,3,4,5,6,7,8,9,-"');
});

gulp.task('display-fonts-big-font-dual-4-digits', function() {
return font_create(
8, 100,
'./node_modules/@fontsource/montserrat/files/montserrat-all-400-normal.woff',
'big_panel_font_dual_4_digits.c', '--symbols="0,1,2,3,4,5,6,7,8,9,-"');
});

gulp.task('display-fonts-temp-hum', function() {
return font_create(
4, 72,
Expand Down Expand Up @@ -240,7 +247,8 @@ gulp.task('display-fonts-14-all', function() {
gulp.task(
'display-fonts',
gulp.series(
'display-fonts-big-font', 'display-fonts-big-font-dual', 'display-fonts-temp-hum',
'display-fonts-big-font', 'display-fonts-big-font-dual',
'display-fonts-big-font-dual-4-digits', 'display-fonts-temp-hum',
'display-fonts-40-regular-number', 'display-fonts-48-all',
'display-fonts-18-uints', 'display-fonts-14-all'));

Expand Down
1 change: 1 addition & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ idf_component_register(SRCS "main.cpp"
"homekit/homekit_integration.cpp"
"generated/display/src/big_panel_font.c"
"generated/display/src/big_panel_font_dual.c"
"generated/display/src/big_panel_font_dual_4_digits.c"
"generated/display/src/temp_hum_font.c"
"generated/display/src/regular_numbers_40_font.c"
"generated/display/src/all_48_font.c"
Expand Down
20 changes: 19 additions & 1 deletion main/ui/ui_main_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ void ui_main_screen::set_sensor_value(sensor_id_index index, float value)
ESP_LOGI(UI_TAG, "Updating sensor %.*s to %g in main screen", get_sensor_name(index).size(), get_sensor_name(index).data(), value);
set_value_in_panel(*pair, index, value);
}

#if defined CONFIG_SCD30_SENSOR_ENABLE || defined CONFIG_SCD4x_SENSOR_ENABLE
// if dual panel
if ((index == sensor_id_index::pm_2_5) || (index == sensor_id_index::CO2))
{
if (pair.has_value() && pair->label)
{
// get number of digits
const auto label_text = lv_label_get_text(pair->label);
if (label_text)
{
const auto len = strlen(label_text);
const auto font = len <= 3 ? &big_panel_font_dual : &big_panel_font_dual_4_digits;
lv_obj_set_style_text_font(pair->label, font, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
#endif
}

void ui_main_screen::show_screen()
Expand Down Expand Up @@ -243,4 +261,4 @@ void ui_main_screen::panel_temperature_callback_event(lv_event_t *e)
sensor_id_index ui_main_screen::get_temperature_sensor_id_index()
{
return config_.is_use_fahrenheit() ? sensor_id_index::temperatureF : sensor_id_index::temperatureC;
}
}
1 change: 1 addition & 0 deletions main/ui/ui_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

LV_FONT_DECLARE(big_panel_font);
LV_FONT_DECLARE(big_panel_font_dual);
LV_FONT_DECLARE(big_panel_font_dual_4_digits);
LV_FONT_DECLARE(temp_hum_font);
LV_FONT_DECLARE(regular_numbers_40_font);
LV_FONT_DECLARE(all_48_font);
Expand Down
3 changes: 2 additions & 1 deletion main/util/async_web_server/http_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ esp_err_t http_request::read_body(const std::function<esp_err_t(const std::vecto
{
if (len == HTTPD_SOCK_ERR_TIMEOUT)
{
ESP_LOGE(WEBSERVER_TAG, "HTTP receive timeout");
ESP_LOGW(WEBSERVER_TAG, "HTTP receive timeout. Retrying.");
continue;
}
return ESP_FAIL;
}
Expand Down
9 changes: 4 additions & 5 deletions main/web_server/web_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,11 @@ void web_server::handle_other_settings_update(esp32::http_request &request)
return;
}

const auto arguments = request.get_form_url_encoded_arguments(
{"hostName", "ntpServer", "ntpServerRefreshInterval", "timezone", "autoScreenBrightness", "screenBrightness", "useFahrenheit"});
const auto arguments = request.get_form_url_encoded_arguments({"hostName", "autoScreenBrightness", "screenBrightness", "useFahrenheit"});
auto &&host_name = arguments[0];
auto &&auto_screen_brightness = arguments[4];
auto &&screen_brightness = arguments[5];
auto &&use_fahrenheit = arguments[6];
auto &&auto_screen_brightness = arguments[1];
auto &&screen_brightness = arguments[2];
auto &&use_fahrenheit = arguments[3];

if (host_name.has_value())
{
Expand Down
8 changes: 4 additions & 4 deletions sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,11 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
#
# Chip revision
#
CONFIG_ESP32S3_REV_MIN_0=y
# CONFIG_ESP32S3_REV_MIN_1 is not set
# CONFIG_ESP32S3_REV_MIN_0 is not set
CONFIG_ESP32S3_REV_MIN_1=y
# CONFIG_ESP32S3_REV_MIN_2 is not set
CONFIG_ESP32S3_REV_MIN_FULL=0
CONFIG_ESP_REV_MIN_FULL=0
CONFIG_ESP32S3_REV_MIN_FULL=1
CONFIG_ESP_REV_MIN_FULL=1

#
# Maximum Supported ESP32-S3 Revision (Rev v0.99)
Expand Down
Loading