Browse Source

update

master
zhaohe 2 years ago
parent
commit
898b3796f8
  1. 4
      pipeline_disinfection_high_power_ctrl_prj (1).launch
  2. 2
      sdk
  3. 46
      usrc/main.cpp

4
pipeline_disinfection_high_power_ctrl_prj (1).launch

@ -36,8 +36,8 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value="001B00273132510838363431"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>

2
sdk

@ -1 +1 @@
Subproject commit 49cd7f76f44ac0dce2b426cd8cf1af29bdeb7c19
Subproject commit 79e923e48f47964c87a526b0c2640d524a3f738d

46
usrc/main.cpp

@ -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");

Loading…
Cancel
Save