diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index f8ac9b4..72f1dcb 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/iflytop_canbus_protocol b/iflytop_canbus_protocol index 0e47768..955c39e 160000 --- a/iflytop_canbus_protocol +++ b/iflytop_canbus_protocol @@ -1 +1 @@ -Subproject commit 0e47768d3761fa4926957ad385416dc9410861bc +Subproject commit 955c39e8b8aa1480b0846a1ae26aaa6ba4e38ce0 diff --git a/usrc/base/hardware.cpp b/usrc/base/hardware.cpp index 7bcce77..62145b2 100644 --- a/usrc/base/hardware.cpp +++ b/usrc/base/hardware.cpp @@ -14,13 +14,13 @@ void Hardware::init() { m_sl_mini_ac_ctrl.initAsOutput(PD14, kxs_gpio_nopull, true, false); // m_sl_mini_ac_ctrl m_atta_mini_air_compressor_ctrl.initAsOutput(PD15, kxs_gpio_nopull, true, false); // m_atta_mini_air_compressor_ctrl - m_motor[0].initialize(&m_motor_spi, MOTOR1_ENN, MOTOR1_CSN); + m_motor[0].initialize(&m_motor_spi, MOTOR0_ENN, MOTOR0_CSN); m_motor[0].setIHOLD_IRUN(1, 15, 0); m_motor[0].setMotorShaft(true); m_motor[0].setAcceleration(300000); m_motor[0].setDeceleration(300000); - m_motor[1].initialize(&m_motor_spi, MOTOR2_ENN, MOTOR2_CSN); + m_motor[1].initialize(&m_motor_spi, MOTOR1_ENN, MOTOR1_CSN); m_motor[1].setIHOLD_IRUN(1, 15, 0); m_motor[1].setMotorShaft(true); m_motor[1].setAcceleration(300000); diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 9d7a819..a4db85f 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -22,11 +22,10 @@ */ #define MOTOR_SPI hspi1 #define MOTOR_CH(n) (n) -#define MOTOR2_CSN PA4 // -#define MOTOR2_ENN PE11 -#define MOTOR1_CSN PC4 // -#define MOTOR1_ENN PE12 - +#define MOTOR0_CSN PC4 // 加液泵 +#define MOTOR0_ENN PE12 // +#define MOTOR1_CSN PA4 // 喷液泵 +#define MOTOR1_ENN PE11 // /*********************************************************************************************************************** * SDK_CONFIG * ***********************************************************************************************************************/ diff --git a/usrc/protocol_impl/protocol_impl_service.cpp b/usrc/protocol_impl/protocol_impl_service.cpp index abb898b..6ead531 100644 --- a/usrc/protocol_impl/protocol_impl_service.cpp +++ b/usrc/protocol_impl/protocol_impl_service.cpp @@ -24,8 +24,8 @@ using namespace iflytop; } #define GET_PARAM(buff, off) ((((int32_t*)(buff))[off])) -#define CLEAR_BIT(val, bit) (val &= ~(1 << bit)) -#define SET_BIT(val, bit) (val |= (1 << bit)) +#define ZCLEAR_BIT(val, bit) (val &= ~(1 << bit)) +#define ZSET_BIT(val, bit) (val |= (1 << bit)) /*********************************************************************************************************************** * VAR_LIST * @@ -110,7 +110,7 @@ static void basic_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t } else if (packet->function_id == kcmd_clear_reset_flag) { - CLEAR_BIT(m_dflag, 0); + ZCLEAR_BIT(m_dflag, 0); zcanbus_send_ack(packet, NULL, 0); } // 触发一次强制上报事件 @@ -256,7 +256,7 @@ static void pump_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t } // ping - else if (packet->function_id == kcmd_pump_get_subic_reg) { + else if (packet->function_id == kcmd_pump_ping) { CHECK_PARAM_LEN(paramNum, 1); int32_t subindex = GET_PARAM(packet->params, 0); @@ -359,7 +359,7 @@ static void zcanbus_on_connected(bool connected) { ZLOGI(TAG, "disconnected from host"); } } -#if 0 +#if 1 static void onPressureSensorDataReportTimer(void const* argument) { // 压力传感器数据上报 static uint8_t reportcache[100]; @@ -433,16 +433,16 @@ void protocol_impl_service_init() { // ForceReportFlagMgr::ins()->init(); motorErrorFlagCacheLock.init(); m_dflag = 0x00; - SET_BIT(m_dflag, 0); + ZSET_BIT(m_dflag, 0); zcanbus_init(deviceInfo_getBoardId()); zcanbus_reglistener(zcanbus_on_rx); zcanbus_reg_on_connected_listener(zcanbus_on_connected); -#if 0 +#if 1 osTimerDef(PressureSensorDataReportTimer, onPressureSensorDataReportTimer); PressureSensorDataReportTimerId = osTimerCreate(osTimer(PressureSensorDataReportTimer), osTimerPeriodic, NULL); - osTimerStart(PressureSensorDataReportTimerId, m_pressureSensorDataReportPeriodMs); + // osTimerStart(PressureSensorDataReportTimerId, m_pressureSensorDataReportPeriodMs); #endif osTimerDef(MotorMonitorTimer, onMotorMonitorTimer); diff --git a/zsdk b/zsdk index 7951cee..450a918 160000 --- a/zsdk +++ b/zsdk @@ -1 +1 @@ -Subproject commit 7951cee7dfc612be73f402914c12933ddffe37cc +Subproject commit 450a91850484e1e575c352aaf63d393055db8238