|
|
@ -26,19 +26,18 @@ |
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "adc.h"
|
|
|
|
#include "iwdg.h"
|
|
|
|
#include "sdk\components\cmdscheduler\cmd_scheduler_v2.hpp"
|
|
|
|
#include "sdk\components\modbus\modbus_block_host.hpp"
|
|
|
|
#include "sdk\components\zcan_module\zcan_high_power_electrical_ctl_module.hpp"
|
|
|
|
#include "sdk\components\zcan_module\zcan_m211887_module_manager.hpp"
|
|
|
|
#include "sdk\hal\zuart.hpp"
|
|
|
|
#include "iwdg.h"
|
|
|
|
|
|
|
|
#define TAG "main"
|
|
|
|
namespace iflytop { |
|
|
|
Main gmain; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
using namespace iflytop; |
|
|
|
|
|
|
|
IflytopCanProtocolStackProcesser m_protocolStack; |
|
|
@ -111,11 +110,11 @@ static void setblowser(bool state) { |
|
|
|
} |
|
|
|
|
|
|
|
void Main::onRceivePacket(CanPacketRxBuffer *rxbuf, uint8_t *packet, size_t len) { |
|
|
|
printf("can rx from %d %d,", rxbuf->id, len); |
|
|
|
for (size_t i = 0; i < len; i++) { |
|
|
|
printf("%02X ", packet[i]); |
|
|
|
} |
|
|
|
printf("\n"); |
|
|
|
// printf("can rx from %d %d,", rxbuf->id, len);
|
|
|
|
// for (size_t i = 0; i < len; i++) {
|
|
|
|
// printf("%02X ", packet[i]);
|
|
|
|
// }
|
|
|
|
// printf("\n");
|
|
|
|
} |
|
|
|
|
|
|
|
void Main::run() { |
|
|
@ -161,6 +160,7 @@ void Main::run() { |
|
|
|
m_basicOrderModule.regInputCtl([this](uint8_t id, bool &val) { return false; }); |
|
|
|
m_basicOrderModule.regOutCtl([this](uint8_t id, bool val) { |
|
|
|
ZLOGI(TAG, "set io %d %d", id, val); |
|
|
|
bool suc = false; |
|
|
|
if (id == 0) { |
|
|
|
AirCompressorCtrl1.setState(val); |
|
|
|
return true; |
|
|
@ -170,11 +170,14 @@ void Main::run() { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (id == 2) { |
|
|
|
AirBlowerCtrl1.setState(val); |
|
|
|
AirBlowerCtrl2.setState(val); |
|
|
|
if (val) { |
|
|
|
m_blowserModbusBlockHost.writeReg06(1, 0x2000, 1, 100); |
|
|
|
suc = m_blowserModbusBlockHost.writeReg06(1, 0x2000, 1, 100); |
|
|
|
} else { |
|
|
|
m_blowserModbusBlockHost.writeReg06(1, 0x2000, 6, 100); |
|
|
|
suc = m_blowserModbusBlockHost.writeReg06(1, 0x2000, 6, 100); |
|
|
|
} |
|
|
|
if (!suc) ZLOGE(TAG, "blowserModbusBlockHost write fail"); |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (id == 3) { |
|
|
@ -199,15 +202,6 @@ void Main::run() { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
if (id == 10) { |
|
|
|
AirBlowerCtrl1.setState(val); |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (id == 11) { |
|
|
|
AirBlowerCtrl2.setState(val); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
}); |
|
|
|
|
|
|
@ -279,22 +273,6 @@ void Main::run() { |
|
|
|
|
|
|
|
cmdScheduler.regCMD("hpp272_read_c1000", "(id)", 1, //
|
|
|
|
[](int32_t paramN, const char **paraV, ICmdParserACK *ack) { |
|
|
|
// int32_t val = m_basicOrderModule.read_adc(atoi(paraV[0]));
|
|
|
|
// uint16_t hydrogen_peroxide_volume; // ppm 0x0100
|
|
|
|
// uint16_t h2o_h2o2_rs; // %RS * 100
|
|
|
|
// uint16_t temperature1; // °C * 100
|
|
|
|
// uint16_t relative_humidity; // %RH * 100
|
|
|
|
// uint16_t absolute_hydrogen_peroxide; // mg/m3
|
|
|
|
// uint16_t h2o_h2o2dew_point_temperature; // °C * 100
|
|
|
|
// uint16_t reserved1; //
|
|
|
|
// uint16_t water_volume; // ppm
|
|
|
|
// uint16_t water_vapor_pressure; // hpa
|
|
|
|
// uint16_t absolute_humidity; // g/m3
|
|
|
|
// uint16_t water_vapor_saturation_pressure_h2o; // hpa
|
|
|
|
// uint16_t temperature2; // °C * 100
|
|
|
|
// uint16_t h2o2_vapor_pressure; // hpa
|
|
|
|
// uint16_t water_vapor_saturation_pressure_h2o_h2o2; // hpa
|
|
|
|
|
|
|
|
auto *sensordata = m_m211887ModuleManager.readSensor(atoi(paraV[0])); |
|
|
|
if (!sensordata) { |
|
|
|
ZLOGE(TAG, "hpp272 is null"); |
|
|
|