diff --git a/commands.cpp b/commands.cpp index 243a27d..7988b75 100644 --- a/commands.cpp +++ b/commands.cpp @@ -255,6 +255,7 @@ void Commands::processPacket(QByteArray data) } break; case COMM_GET_BMS_NET_SETTINGS: + case COMM_GET_BMS_NET_DEFAULT_SETTINGS: { QStringList settings; settings << vb.mid(0, 250); @@ -347,6 +348,13 @@ void Commands::getNetSettings() emitData(vb); } +void Commands::getNetDefaultSettings() +{ + VByteArray vb; + vb.vbAppendInt8(COMM_GET_BMS_NET_DEFAULT_SETTINGS); + emitData(vb); +} + void Commands::setNetSettings(QStringList settings) { VByteArray vb; diff --git a/commands.h b/commands.h index b98b51c..bc8a7b9 100644 --- a/commands.h +++ b/commands.h @@ -82,6 +82,7 @@ public slots: void getAux(); void getExpansionTemp(); void getNetSettings(); + void getNetDefaultSettings(); void setNetSettings(QStringList settings); void sendTerminalCmd(QString cmd); void setDetect(disp_pos_mode mode); diff --git a/datatypes.h b/datatypes.h index f8a17dd..24f9de8 100644 --- a/datatypes.h +++ b/datatypes.h @@ -416,8 +416,9 @@ typedef enum { COMM_GET_BMS_CELLS, COMM_GET_BMS_AUX, COMM_GET_BMS_EXP_TEMP, - COMM_GET_BMS_NET_SETTINGS = 154, - COMM_SET_BMS_NET_SETTINGS = 156 + COMM_GET_BMS_NET_SETTINGS, + COMM_GET_BMS_NET_DEFAULT_SETTINGS, + COMM_SET_BMS_NET_SETTINGS, } COMM_PACKET_ID; typedef struct { diff --git a/qml/Screens/NetworkSettingsScreen.qml b/qml/Screens/NetworkSettingsScreen.qml index 270b4c5..5e8cfa1 100644 --- a/qml/Screens/NetworkSettingsScreen.qml +++ b/qml/Screens/NetworkSettingsScreen.qml @@ -167,21 +167,30 @@ ColumnLayout { Layout.fillWidth: true } - Controls.Button { - text: qsTr("Apply") - onClicked: { - if (!BmsInterface.isPortConnected()) - return + RowLayout { + spacing: 20 - var settings = [ - firstUrlField.text, - secondUrlField.text, - apnField.text, - userField.text, - passwordField.text, - ] + Controls.OutlineButton { + text: qsTr("Default") + onClicked: BmsInterface.commands().getNetDefaultSettings() + } - BmsInterface.commands().setNetSettings(settings) + Controls.Button { + text: qsTr("Apply") + onClicked: { + if (!BmsInterface.isPortConnected()) + return + + var settings = [ + firstUrlField.text, + secondUrlField.text, + apnField.text, + userField.text, + passwordField.text, + ] + + BmsInterface.commands().setNetSettings(settings) + } } } diff --git a/qml/Screens/TimeSettingsScreen.qml b/qml/Screens/TimeSettingsScreen.qml index 239ff6d..f6df266 100644 --- a/qml/Screens/TimeSettingsScreen.qml +++ b/qml/Screens/TimeSettingsScreen.qml @@ -212,6 +212,7 @@ ColumnLayout { const localTimestamp = (Math.round(date / 1000) - date.getTimezoneOffset() * 60).toString(16) BmsInterface.commands().sendTerminalCmd("setUnixTime " + localTimestamp) + Qt.callLater(BmsInterface.emitStatusMessage, qsTr("Time settings applied successfully"), true) } } } diff --git a/translations/cubo_en.ts b/translations/cubo_en.ts index 44ec989..40de71b 100644 --- a/translations/cubo_en.ts +++ b/translations/cubo_en.ts @@ -14,52 +14,52 @@ - + Number of modules - + Battery voltage, V - + Number of cells - + Nominal capacity, A/h - + Actual capacity, A/h - + Battery temperature, °C - + BMS temperature, °C - + Maximum cell voltage, V - + Minimum cell voltage, V - + Current @@ -492,50 +492,50 @@ Wait, please. - + Network settings applied successfully - - + + Buffer erase - + Buffer erase timeout - + CRC/Size write - + CRC/Size write timeout - + Firmware data write - + Firmware data write timeout - + Firmware update completed! Reconnect to the board if you want to continue working with it. - + Cancelled @@ -782,7 +782,12 @@ Reconnect to the board if you want to continue working with it. - + + Default + + + + Apply @@ -935,6 +940,11 @@ Reconnect to the board if you want to continue working with it. Write to board + + + Time settings applied successfully + + Translator diff --git a/translations/cubo_it.ts b/translations/cubo_it.ts index 28258c1..384f204 100644 --- a/translations/cubo_it.ts +++ b/translations/cubo_it.ts @@ -14,52 +14,52 @@ - + Number of modules - + Battery voltage, V - + Number of cells - + Nominal capacity, A/h - + Actual capacity, A/h - + Battery temperature, °C - + BMS temperature, °C - + Maximum cell voltage, V - + Minimum cell voltage, V - + Current @@ -492,50 +492,50 @@ Wait, please. - + Network settings applied successfully - - + + Buffer erase - + Buffer erase timeout - + CRC/Size write - + CRC/Size write timeout - + Firmware data write - + Firmware data write timeout - + Firmware update completed! Reconnect to the board if you want to continue working with it. - + Cancelled @@ -782,7 +782,12 @@ Reconnect to the board if you want to continue working with it. - + + Default + + + + Apply @@ -935,6 +940,11 @@ Reconnect to the board if you want to continue working with it. Write to board + + + Time settings applied successfully + + Translator diff --git a/translations/cubo_ru.qm b/translations/cubo_ru.qm index d7b9f6e..6ad37d3 100644 Binary files a/translations/cubo_ru.qm and b/translations/cubo_ru.qm differ diff --git a/translations/cubo_ru.ts b/translations/cubo_ru.ts index fb805bb..9014c28 100644 --- a/translations/cubo_ru.ts +++ b/translations/cubo_ru.ts @@ -14,52 +14,52 @@ Степень заряда батареи, % - + Number of modules Количество модулей - + Battery voltage, V Напряжение батареи, В - + Number of cells Количество ячеек - + Nominal capacity, A/h Номинальная ёмкость, А/ч - + Actual capacity, A/h Реальная ёмкость, А/ч - + Battery temperature, °C Температура батареи, °C - + BMS temperature, °C Температура BMS, °C - + Maximum cell voltage, V Максимальное напряжение на ячейке, В - + Minimum cell voltage, V Минимальное напряжение на ячейке, В - + Current Ток @@ -509,43 +509,43 @@ Wait, please. Конфигурация BMS установлена - + Network settings applied successfully Настройки сети успешно применены - - + + Buffer erase Стирание буфера - + Buffer erase timeout Таймаут стирания буфера - + CRC/Size write Запись контрольной суммы - + CRC/Size write timeout Таймаут записи контрольной суммы - + Firmware data write Запись данных прошивки - + Firmware data write timeout Таймаут записи данных прошивки - + Firmware update completed! Reconnect to the board if you want to continue working with it. @@ -558,7 +558,7 @@ Reconnect to the board if you want to continue working with it. Обновление прошивки завершено - + Cancelled Отменено @@ -817,7 +817,12 @@ Reconnect to the board if you want to continue working with it. Пароль - + + Default + По умолчанию + + + Apply Применить @@ -970,6 +975,11 @@ Reconnect to the board if you want to continue working with it. Write to board Записать на плату + + + Time settings applied successfully + Настройки времени успешно применены + Translator