diff --git a/applications/EmsShower/customdisplaypanel.cpp b/applications/EmsShower/customdisplaypanel.cpp index 1e40860..80fa00f 100644 --- a/applications/EmsShower/customdisplaypanel.cpp +++ b/applications/EmsShower/customdisplaypanel.cpp @@ -158,14 +158,15 @@ void CustomDisplayPanel::UpdateData(OpenJson& json) int panel_type = json["panel_type"].i32(); qDebug() << panel_type; - if (panel_type == CustomDisplayPanel::PANEL_TEMPERATURE) - { - UpdateTemperature(json); - } - else if (panel_type == CustomDisplayPanel::PANEL_ALARM) + if (panel_type == CustomDisplayPanel::PANEL_ALARM) { UpdateAlarm(json); } + + else //(panel_type == CustomDisplayPanel::PANEL_TEMPERATURE) + { + UpdateTemperature(json); + } } void CustomDisplayPanel::UpdateTemperature(OpenJson &json) diff --git a/applications/EmsShower/emsshower.json b/applications/EmsShower/emsshower.json index b086efd..7666278 100644 --- a/applications/EmsShower/emsshower.json +++ b/applications/EmsShower/emsshower.json @@ -19,6 +19,7 @@ "start_addr":40000, "quantity":9, "bytes_per_register":2, + "language":"en", "device_name_chn":"温湿度", "device_name_eng":"Temperature", "device_type":1, @@ -119,6 +120,7 @@ "start_addr":40009, "quantity":6, "bytes_per_register":2, + "language":"en", "device_name_chn":"温湿度告警", "device_name_eng":"Alarm", "device_type":6, @@ -180,7 +182,7 @@ "unit":"", "title_chn":"低温告警", "title_eng":"Low Temp.", - "display":0, + "display":1, "skip":0 } ] diff --git a/applications/EmsShower/mainwindow.cpp b/applications/EmsShower/mainwindow.cpp index 2b2d309..1be7d1e 100644 --- a/applications/EmsShower/mainwindow.cpp +++ b/applications/EmsShower/mainwindow.cpp @@ -261,6 +261,7 @@ void MainWindow::ReadConfiguration(QString jsonFilePath) address_item.start_addr = nodeAddrItem["start_addr"].i32(); address_item.quantity = nodeAddrItem["quantity"].i32(); address_item.bytes_per_register = nodeAddrItem["bytes_per_register"].i32(); + address_item.lang = nodeAddrItem["language"].s(); address_item.device_name_chn = nodeAddrItem["device_name_chn"].s(); address_item.device_name_eng = nodeAddrItem["device_name_eng"].s(); address_item.device_type = nodeAddrItem["device_type"].i32(); @@ -724,7 +725,10 @@ void MainWindow::DecodeSync(const QVector& array,const slaveAddress& s ddi.display_location = iter->second.display; ddi.order = iter->second.order; ddi.precision = iter->second.precision; - ddi.title = iter->second.title_en; + if (QString::fromStdString(sa.lang.c_str()).toLower() == "chn") + ddi.title = iter->second.title_chn; + else + ddi.title = iter->second.title_en; ddi.unit = iter->second.unit; ddi.value = array[idx]; pGeneralData->m_PanelDisplayDataItems.emplace_back(ddi); diff --git a/applications/EmsShower/slave_define.h b/applications/EmsShower/slave_define.h index abc7a3a..c8b1e6f 100644 --- a/applications/EmsShower/slave_define.h +++ b/applications/EmsShower/slave_define.h @@ -126,6 +126,7 @@ typedef struct __slaveAddress int start_addr; // ":40000, 寄存器地址 unsigned short quantity; // " : 9, 连续读取多少个寄存器 unsigned short bytes_per_register; // " : 2, 每个寄存器的字节数,缺省是uint16,两个字节 + std::string lang; // 使用语言,"chn": 中文 "en":English std::string device_name_chn; // " : "温湿度", 该寄存器数组代表的设备名称 std::string device_name_eng; // " : "温湿度", 该寄存器数组代表的设备名称,英文