Browse Source

fix some bug

try_support_dt100n
zhaohe 4 weeks ago
parent
commit
39e4fd64f6
  1. 8
      app_protocols/appexception/appexception.hpp
  2. 5
      appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp
  3. 8
      appsrc/service/app/air_leak_detect_test.cpp

8
app_protocols/appexception/appexception.hpp

@ -140,11 +140,15 @@ class appexception : public std::exception {
return ret;
}
};
}
#define APPCHECK(expr, ecode, info) \
if (!(expr)) { \
THROW_APP_EXCEPTION(ecode, info); \
}
#define THROW_APP_EXCEPTION(ecode, info) throw appexception(ecode, info);
} // namespace iflytop
#define THROW_APP_EXCEPTION(ecode, _info) \
{logger->error("throw exception {}", _info);\
throw appexception(ecode, _info); }

5
appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp

@ -104,7 +104,7 @@ shared_ptr<Receipt> ZSCanProtocolCom::base_callcmd(int32_t to, int32_t cmdid, ui
if (m_receipt_frame->ptype == kerror_receipt) {
int32_t ecode = *(int32_t *)m_receipt_frame->params;
THROW_APP_EXCEPTION(ecode, Internationalization::ecode2description(ecode, cmdid, to, param, paramLen));
THROW_APP_EXCEPTION(ecode, Internationalization::ecode2description(ecode, to, cmdid, param, paramLen));
}
shared_ptr<Receipt> receipt = make_shared<Receipt>();
@ -146,7 +146,7 @@ shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t
break;
}
THROW_APP_EXCEPTION(ecode, Internationalization::ecode2description(ecode, cmdid, to, param, paramLen));
THROW_APP_EXCEPTION(ecode, Internationalization::ecode2description(ecode, to, cmdid, param, paramLen));
return nullptr;
}
shared_ptr<Receipt> ZSCanProtocolCom::callcmd0(int32_t to, int32_t cmdid, int32_t overtime) { return callcmd(to, cmdid, nullptr, 0, overtime); }
@ -186,7 +186,6 @@ shared_ptr<Receipt> ZSCanProtocolCom::callcmd5(int32_t to, int32_t cmdid, int32_
return callcmd(to, cmdid, (uint8_t *)param, 20, overtime);
}
void ZSCanProtocolCom::callOnReport(uint8_t from, uint8_t *hex, uint32_t hexlen) {
shared_ptr<ZBin> hexbin = make_shared<ZBin>(hex, hexlen);
m_wq->enQueue([this, from, hexbin]() { onReport(from, (uint8_t *)hexbin->data(), hexbin->size()); });

8
appsrc/service/app/air_leak_detect_test.cpp

@ -22,7 +22,7 @@ void AirLeakDetectTest::initialize() {
stateUpdateThread.reset(new Thread("AirLeakDetectTest-stateUpdateThread", [this]() {
while (!ThisThread().getExitFlag()) {
try {
try {
SEND_CLASS_REPORT(thisClass.className, "stateUpdate", getState());
} catch (const std::exception& e) {
logger->error("stateUpdateThread error:{}", e.what());
@ -211,9 +211,9 @@ json AirLeakDetectTest::getState() {
diffPressurePa = 0;
}
state["pressure"] = fmt::format("{:.2f}", toDisplayPressure(pressurePa));
state["initialPressure"] = fmt::format("{:.2f}", toDisplayPressure(initialPressurePa));
state["diffPressurePa"] = fmt::format("{:.2f}", toDisplayPressure(diffPressurePa));
state["pressure"] = toDisplayPressure(pressurePa);
state["initialPressure"] = toDisplayPressure(initialPressurePa);
state["diffPressurePa"] = toDisplayPressure(diffPressurePa);
state["workState"] = state2str(getWorkstate());
state["workStateDisplay"] = state2chstr(getWorkstate());
return state;

Loading…
Cancel
Save