Skip to content

Commit d09537e

Browse files
authored
Add V2 parition tables (#1137)
* v1.9.0: update font icons, add mqtt reconnect * Add v2 parition tables
1 parent 86921f4 commit d09537e

40 files changed

+185
-103
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# CMakeLists in this exact order for cmake to work correctly
55
cmake_minimum_required(VERSION 3.16)
66

7-
set(PROJECT_VER "1.8.9")
7+
set(PROJECT_VER "1.9.0")
88

99
# Add this line to disable the specific warning
1010
add_compile_options(-Wno-missing-field-initializers)

main/application.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "audio_codec.h"
66
#include "mqtt_protocol.h"
77
#include "websocket_protocol.h"
8-
#include "font_awesome_symbols.h"
98
#include "assets/lang_config.h"
109
#include "mcp_server.h"
1110

@@ -14,6 +13,7 @@
1413
#include <cJSON.h>
1514
#include <driver/gpio.h>
1615
#include <arpa/inet.h>
16+
#include <font_awesome.h>
1717

1818
#define TAG "Application"
1919

@@ -87,7 +87,7 @@ void Application::CheckNewVersion(Ota& ota) {
8787

8888
char buffer[256];
8989
snprintf(buffer, sizeof(buffer), Lang::Strings::CHECK_NEW_VERSION_FAILED, retry_delay, ota.GetCheckVersionUrl().c_str());
90-
Alert(Lang::Strings::ERROR, buffer, "sad", Lang::Sounds::OGG_EXCLAMATION);
90+
Alert(Lang::Strings::ERROR, buffer, "cloud_slash", Lang::Sounds::OGG_EXCLAMATION);
9191

9292
ESP_LOGW(TAG, "Check new version failed, retry in %d seconds (%d/%d)", retry_delay, retry_count, MAX_RETRY);
9393
for (int i = 0; i < retry_delay; i++) {
@@ -103,13 +103,12 @@ void Application::CheckNewVersion(Ota& ota) {
103103
retry_delay = 10; // 重置重试延迟时间
104104

105105
if (ota.HasNewVersion()) {
106-
Alert(Lang::Strings::OTA_UPGRADE, Lang::Strings::UPGRADING, "happy", Lang::Sounds::OGG_UPGRADE);
106+
Alert(Lang::Strings::OTA_UPGRADE, Lang::Strings::UPGRADING, "download", Lang::Sounds::OGG_UPGRADE);
107107

108108
vTaskDelay(pdMS_TO_TICKS(3000));
109109

110110
SetDeviceState(kDeviceStateUpgrading);
111111

112-
display->SetIcon(FONT_AWESOME_DOWNLOAD);
113112
std::string message = std::string(Lang::Strings::NEW_VERSION) + ota.GetFirmwareVersion();
114113
display->SetChatMessage("system", message.c_str());
115114

@@ -130,7 +129,7 @@ void Application::CheckNewVersion(Ota& ota) {
130129
ESP_LOGE(TAG, "Firmware upgrade failed, restarting audio service and continuing operation...");
131130
audio_service_.Start(); // Restart audio service
132131
board.SetPowerSaveMode(true); // Restore power save mode
133-
Alert(Lang::Strings::ERROR, Lang::Strings::UPGRADE_FAILED, "sad", Lang::Sounds::OGG_EXCLAMATION);
132+
Alert(Lang::Strings::ERROR, Lang::Strings::UPGRADE_FAILED, "circle_xmark", Lang::Sounds::OGG_EXCLAMATION);
134133
vTaskDelay(pdMS_TO_TICKS(3000));
135134
// Continue to normal operation (don't break, just fall through)
136135
} else {
@@ -195,7 +194,7 @@ void Application::ShowActivationCode(const std::string& code, const std::string&
195194
}};
196195

197196
// This sentence uses 9KB of SRAM, so we need to wait for it to finish
198-
Alert(Lang::Strings::ACTIVATION, message.c_str(), "happy", Lang::Sounds::OGG_ACTIVATION);
197+
Alert(Lang::Strings::ACTIVATION, message.c_str(), "link", Lang::Sounds::OGG_ACTIVATION);
199198

200199
for (const auto& digit : code) {
201200
auto it = std::find_if(digit_sounds.begin(), digit_sounds.end(),
@@ -207,7 +206,7 @@ void Application::ShowActivationCode(const std::string& code, const std::string&
207206
}
208207

209208
void Application::Alert(const char* status, const char* message, const char* emotion, const std::string_view& sound) {
210-
ESP_LOGW(TAG, "Alert %s: %s [%s]", status, message, emotion);
209+
ESP_LOGW(TAG, "Alert [%s] %s: %s", emotion, status, message);
211210
auto display = Board::GetInstance().GetDisplay();
212211
display->SetStatus(status);
213212
display->SetEmotion(emotion);
@@ -378,6 +377,10 @@ void Application::Start() {
378377
protocol_ = std::make_unique<MqttProtocol>();
379378
}
380379

380+
protocol_->OnConnected([this]() {
381+
DismissAlert();
382+
});
383+
381384
protocol_->OnNetworkError([this](const std::string& message) {
382385
last_error_message_ = message;
383386
xEventGroupSetBits(event_group_, MAIN_EVENT_ERROR);
@@ -546,7 +549,7 @@ void Application::MainEventLoop() {
546549
MAIN_EVENT_ERROR, pdTRUE, pdFALSE, portMAX_DELAY);
547550
if (bits & MAIN_EVENT_ERROR) {
548551
SetDeviceState(kDeviceStateIdle);
549-
Alert(Lang::Strings::ERROR, last_error_message_.c_str(), "sad", Lang::Sounds::OGG_EXCLAMATION);
552+
Alert(Lang::Strings::ERROR, last_error_message_.c_str(), "circle_xmark", Lang::Sounds::OGG_EXCLAMATION);
550553
}
551554

552555
if (bits & MAIN_EVENT_SEND_AUDIO) {

main/application.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <string>
1010
#include <mutex>
1111
#include <deque>
12-
#include <vector>
1312
#include <memory>
1413

1514
#include "protocol.h"

main/boards/atoms3-echo-base/atoms3_echo_base.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class AtomS3EchoBaseBoard : public WifiBoard {
111111
InitializeButtons();
112112
GetBacklight()->SetBrightness(100);
113113
display_->SetStatus(Lang::Strings::ERROR);
114-
display_->SetEmotion("sad");
114+
display_->SetEmotion("triangle_exclamation");
115115
display_->SetChatMessage("system", "Echo Base\nnot connected");
116116

117117
while (1) {

main/boards/atoms3r-echo-base/atoms3r_echo_base.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class AtomS3rEchoBaseBoard : public WifiBoard {
177177
InitializeButtons();
178178
GetBacklight()->SetBrightness(100);
179179
display_->SetStatus(Lang::Strings::ERROR);
180-
display_->SetEmotion("sad");
180+
display_->SetEmotion("triangle_exclamation");
181181
display_->SetChatMessage("system", "Echo Base\nnot connected");
182182

183183
while (1) {

main/boards/common/ml307_board.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
#include "application.h"
44
#include "display.h"
5-
#include "font_awesome_symbols.h"
65
#include "assets/lang_config.h"
76

87
#include <esp_log.h>
98
#include <esp_timer.h>
9+
#include <font_awesome.h>
1010
#include <opus_encoder.h>
1111

1212
static const char *TAG = "Ml307Board";
@@ -50,9 +50,9 @@ void Ml307Board::StartNetwork() {
5050
while (true) {
5151
auto result = modem_->WaitForNetworkReady();
5252
if (result == NetworkStatus::ErrorInsertPin) {
53-
application.Alert(Lang::Strings::ERROR, Lang::Strings::PIN_ERROR, "sad", Lang::Sounds::OGG_ERR_PIN);
53+
application.Alert(Lang::Strings::ERROR, Lang::Strings::PIN_ERROR, "triangle_exclamation", Lang::Sounds::OGG_ERR_PIN);
5454
} else if (result == NetworkStatus::ErrorRegistrationDenied) {
55-
application.Alert(Lang::Strings::ERROR, Lang::Strings::REG_ERROR, "sad", Lang::Sounds::OGG_ERR_REG);
55+
application.Alert(Lang::Strings::ERROR, Lang::Strings::REG_ERROR, "triangle_exclamation", Lang::Sounds::OGG_ERR_REG);
5656
} else {
5757
break;
5858
}
@@ -80,13 +80,13 @@ const char* Ml307Board::GetNetworkStateIcon() {
8080
if (csq == -1) {
8181
return FONT_AWESOME_SIGNAL_OFF;
8282
} else if (csq >= 0 && csq <= 14) {
83-
return FONT_AWESOME_SIGNAL_1;
83+
return FONT_AWESOME_SIGNAL_WEAK;
8484
} else if (csq >= 15 && csq <= 19) {
85-
return FONT_AWESOME_SIGNAL_2;
85+
return FONT_AWESOME_SIGNAL_FAIR;
8686
} else if (csq >= 20 && csq <= 24) {
87-
return FONT_AWESOME_SIGNAL_3;
87+
return FONT_AWESOME_SIGNAL_GOOD;
8888
} else if (csq >= 25 && csq <= 31) {
89-
return FONT_AWESOME_SIGNAL_4;
89+
return FONT_AWESOME_SIGNAL_STRONG;
9090
}
9191

9292
ESP_LOGW(TAG, "Invalid CSQ: %d", csq);

main/boards/common/wifi_board.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "display.h"
44
#include "application.h"
55
#include "system_info.h"
6-
#include "font_awesome_symbols.h"
76
#include "settings.h"
87
#include "assets/lang_config.h"
98

@@ -12,6 +11,7 @@
1211
#include <esp_network.h>
1312
#include <esp_log.h>
1413

14+
#include <font_awesome.h>
1515
#include <wifi_station.h>
1616
#include <wifi_configuration_ap.h>
1717
#include <ssid_manager.h>
@@ -49,7 +49,7 @@ void WifiBoard::EnterWifiConfigMode() {
4949
hint += "\n\n";
5050

5151
// 播报配置 WiFi 的提示
52-
application.Alert(Lang::Strings::WIFI_CONFIG_MODE, hint.c_str(), "", Lang::Sounds::OGG_WIFICONFIG);
52+
application.Alert(Lang::Strings::WIFI_CONFIG_MODE, hint.c_str(), "gear", Lang::Sounds::OGG_WIFICONFIG);
5353

5454
#if CONFIG_USE_ACOUSTIC_WIFI_PROVISIONING
5555
auto display = Board::GetInstance().GetDisplay();
@@ -124,7 +124,7 @@ const char* WifiBoard::GetNetworkStateIcon() {
124124
}
125125
auto& wifi_station = WifiStation::GetInstance();
126126
if (!wifi_station.IsConnected()) {
127-
return FONT_AWESOME_WIFI_OFF;
127+
return FONT_AWESOME_WIFI_SLASH;
128128
}
129129
int8_t rssi = wifi_station.GetRssi();
130130
if (rssi >= -60) {

main/boards/df-k10/df_k10_board.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "display/lcd_display.h"
44
#include "esp_lcd_ili9341.h"
55
#include "led_control.h"
6-
#include "font_awesome_symbols.h"
76
#include "application.h"
87
#include "button.h"
98
#include "config.h"

main/boards/electron-bot/electron_emoji_display.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "electron_emoji_display.h"
22

33
#include <esp_log.h>
4+
#include <font_awesome.h>
45

56
#include <algorithm>
67
#include <cstring>
78
#include <string>
89

9-
#include "font_awesome_symbols.h"
1010

1111
#define TAG "ElectronEmojiDisplay"
1212

main/boards/esp-box-3/esp_box3_board.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "codecs/box_audio_codec.h"
33
#include "display/lcd_display.h"
44
#include "esp_lcd_ili9341.h"
5-
#include "font_awesome_symbols.h"
65
#include "application.h"
76
#include "button.h"
87
#include "config.h"

0 commit comments

Comments
 (0)