diff --git a/chip/api/zi_pwm_ctrl.hpp b/chip/api/zi_pwm_ctrl.hpp index f974fb3..df1fb22 100644 --- a/chip/api/zi_pwm_ctrl.hpp +++ b/chip/api/zi_pwm_ctrl.hpp @@ -7,9 +7,13 @@ class ZIPWMCtrl { public: virtual ~ZIPWMCtrl(){}; - virtual int32_t set_pwm_duty(int32_t duty) = 0; - virtual int32_t set_pwm_freq(int32_t freq) = 0; - virtual int32_t get_pwm_duty() = 0; - virtual int32_t get_pwm_freq() = 0; + virtual int32_t pwm_set_state(int32_t state) = 0; + virtual int32_t pwm_get_state(int32_t& state) = 0; + + virtual int32_t set_pwm_duty(int32_t duty) = 0; + virtual int32_t get_pwm_duty(int32_t& duty) = 0; + + virtual int32_t set_pwm_freq(int32_t freq) = 0; + virtual int32_t get_pwm_freq(int32_t& duty) = 0; }; } // namespace iflytop diff --git a/components/mini_servo_motor/feite_servo_motor.cpp b/components/mini_servo_motor/feite_servo_motor.cpp index 9a8bb57..219af11 100644 --- a/components/mini_servo_motor/feite_servo_motor.cpp +++ b/components/mini_servo_motor/feite_servo_motor.cpp @@ -320,11 +320,11 @@ bool FeiTeServoMotor::write_reg(uint8_t id, bool async, uint8_t add, uint8_t* da uint8_t checksum = checksum_packet((uint8_t*)cmd_header, txpacketlen); m_txbuf[txpacketlen - 1] = checksum; if (!tx_and_rx(m_txbuf, txpacketlen, m_rxbuf, rxpacketlen, OVERTIME)) { - ZLOGE(TAG, "write_reg fail,overtime"); + ZLOGE(TAG, "%d write_reg fail,overtime",id); return false; } if (!(receipt_header->header == 0xffff && receipt_header->id == id)) { - ZLOGE(TAG, "write_reg fail,receipt header error"); + ZLOGE(TAG, "%d write_reg fail,receipt header error",id); return false; } return true; diff --git a/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp b/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp index 8a34ae8..e1d5944 100644 --- a/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp +++ b/components/mini_servo_motor/mini_servo_motor_ctrl_module.cpp @@ -432,4 +432,7 @@ int32_t MiniRobotCtrlModule::motor_easy_move_by(int32_t distance) { return move_ int32_t MiniRobotCtrlModule::motor_easy_move_to(int32_t position) { return move_to(position, m_cfg.default_velocity, m_cfg.default_torque, nullptr); } int32_t MiniRobotCtrlModule::motor_easy_move_to_zero(int32_t direction) { return motor_easy_move_to(0); } -int32_t MiniRobotCtrlModule::motor_easy_set_current_pos(int32_t pos) { return position_calibrate(pos); } +int32_t MiniRobotCtrlModule::motor_easy_set_current_pos(int32_t pos) { + ZLOGI(TAG, "%d motor_easy_set_current_pos %d", m_module_id, pos); + return position_calibrate(pos); +} diff --git a/components/sub_modbus_module/sub_modbus_board_initer.cpp b/components/sub_modbus_module/sub_modbus_board_initer.cpp index 7f79080..4b43254 100644 --- a/components/sub_modbus_module/sub_modbus_board_initer.cpp +++ b/components/sub_modbus_module/sub_modbus_board_initer.cpp @@ -7,7 +7,8 @@ #include "project_configs.h" using namespace iflytop; -#define TAG "main" +#define TAG "main" + #ifdef PC_MODBUS_UART extern DMA_HandleTypeDef PC_DEBUG_UART_DMA_HANDLER; @@ -62,4 +63,8 @@ void SubModbusBoardIniter::loop() { ModulebusClient::Inst()->loop(); } } +<<<<<<< HEAD +======= + +>>>>>>> 187b88da24aed4d0c06bb06e3158b01c2612b57d #endif \ No newline at end of file diff --git a/components/sub_modbus_module/sub_modbus_board_initer.hpp b/components/sub_modbus_module/sub_modbus_board_initer.hpp index cb8298d..92076a2 100644 --- a/components/sub_modbus_module/sub_modbus_board_initer.hpp +++ b/components/sub_modbus_module/sub_modbus_board_initer.hpp @@ -13,7 +13,6 @@ namespace iflytop { #ifdef PC_MODBUS_UART - class SubModbusBoardIniter { public: void init(int deviceId, // diff --git a/components/zcancmder/zcan_board_module.cpp b/components/zcancmder/zcan_board_module.cpp index 6f0d22e..c1ecc17 100644 --- a/components/zcancmder/zcan_board_module.cpp +++ b/components/zcancmder/zcan_board_module.cpp @@ -60,11 +60,20 @@ int32_t ZCanBoardModule::module_xxx_reg(int32_t param_id, bool read, int32_t &va PROCESS_REG(kreg_pwm0_duty, readPwmDuty(0, val), setPwmDuty(0, val)); PROCESS_REG(kreg_pwm1_duty, readPwmDuty(1, val), setPwmDuty(1, val)); PROCESS_REG(kreg_pwm2_duty, readPwmDuty(2, val), setPwmDuty(2, val)); - PROCESS_REG(kreg_pwm3_duty, readPwmDuty(2, val), setPwmDuty(2, val)); - PROCESS_REG(kreg_pwm4_duty, readPwmDuty(2, val), setPwmDuty(2, val)); - PROCESS_REG(kreg_pwm5_duty, readPwmDuty(2, val), setPwmDuty(2, val)); - PROCESS_REG(kreg_pwm6_duty, readPwmDuty(2, val), setPwmDuty(2, val)); - PROCESS_REG(kreg_pwm7_duty, readPwmDuty(2, val), setPwmDuty(2, val)); + PROCESS_REG(kreg_pwm3_duty, readPwmDuty(3, val), setPwmDuty(3, val)); + PROCESS_REG(kreg_pwm4_duty, readPwmDuty(4, val), setPwmDuty(4, val)); + PROCESS_REG(kreg_pwm5_duty, readPwmDuty(5, val), setPwmDuty(5, val)); + PROCESS_REG(kreg_pwm6_duty, readPwmDuty(6, val), setPwmDuty(6, val)); + PROCESS_REG(kreg_pwm7_duty, readPwmDuty(7, val), setPwmDuty(7, val)); + + PROCESS_REG(kreg_pwm0_ctrl, getPwmState(0, val), setPwmState(0, val)); + PROCESS_REG(kreg_pwm1_ctrl, getPwmState(1, val), setPwmState(1, val)); + PROCESS_REG(kreg_pwm2_ctrl, getPwmState(2, val), setPwmState(2, val)); + PROCESS_REG(kreg_pwm3_ctrl, getPwmState(3, val), setPwmState(3, val)); + PROCESS_REG(kreg_pwm4_ctrl, getPwmState(4, val), setPwmState(4, val)); + PROCESS_REG(kreg_pwm5_ctrl, getPwmState(5, val), setPwmState(5, val)); + PROCESS_REG(kreg_pwm6_ctrl, getPwmState(6, val), setPwmState(6, val)); + PROCESS_REG(kreg_pwm7_ctrl, getPwmState(7, val), setPwmState(7, val)); PROCESS_REG(kreg_pwm0_freq, readPwmFreq(0, val), setPwmFreq(0, val)); PROCESS_REG(kreg_pwm1_freq, readPwmFreq(1, val), setPwmFreq(1, val)); @@ -73,6 +82,7 @@ int32_t ZCanBoardModule::module_xxx_reg(int32_t param_id, bool read, int32_t &va PROCESS_REG(kreg_pwm4_freq, readPwmFreq(4, val), setPwmFreq(4, val)); PROCESS_REG(kreg_pwm5_freq, readPwmFreq(5, val), setPwmFreq(5, val)); PROCESS_REG(kreg_pwm6_freq, readPwmFreq(6, val), setPwmFreq(6, val)); + PROCESS_REG(kreg_pwm7_freq, readPwmFreq(7, val), setPwmFreq(7, val)); default: return err::kmodule_not_find_config_index; @@ -119,6 +129,25 @@ int32_t ZCanBoardModule::readTemperature(int32_t sensorId, int32_t &temperature_ return temperature_sensor[sensorId]->getTemperature(temperature_val); } +int32_t ZCanBoardModule::setPwmState(int32_t pwmId, int32_t state) { + if (pwmId < 0 || pwmId >= ZARRAY_SIZE(m_cfg.pwmctrl)) { + return err::kmodule_not_find_config_index; + } + if (m_cfg.pwmctrl[pwmId] == nullptr) { + return err::kmodule_not_find_config_index; + } + return m_cfg.pwmctrl[pwmId]->pwm_set_state(state); +} +int32_t ZCanBoardModule::getPwmState(int32_t pwmId, int32_t &state) { + if (pwmId < 0 || pwmId >= ZARRAY_SIZE(m_cfg.pwmctrl)) { + return err::kmodule_not_find_config_index; + } + if (m_cfg.pwmctrl[pwmId] == nullptr) { + return err::kmodule_not_find_config_index; + } + return m_cfg.pwmctrl[pwmId]->pwm_get_state(state); +} + int32_t ZCanBoardModule::readPwmDuty(int32_t pwmId, int32_t &duty) { if (pwmId < 0 || pwmId >= ZARRAY_SIZE(m_cfg.pwmctrl)) { return err::kmodule_not_find_config_index; @@ -126,8 +155,7 @@ int32_t ZCanBoardModule::readPwmDuty(int32_t pwmId, int32_t &duty) { if (m_cfg.pwmctrl[pwmId] == nullptr) { return err::kmodule_not_find_config_index; } - duty = m_cfg.pwmctrl[pwmId]->get_pwm_duty(); - return 0; + return m_cfg.pwmctrl[pwmId]->get_pwm_duty(duty); } int32_t ZCanBoardModule::setPwmDuty(int32_t pwmId, int32_t duty) { if (pwmId < 0 || pwmId >= ZARRAY_SIZE(m_cfg.pwmctrl)) { @@ -136,8 +164,7 @@ int32_t ZCanBoardModule::setPwmDuty(int32_t pwmId, int32_t duty) { if (m_cfg.pwmctrl[pwmId] == nullptr) { return err::kmodule_not_find_config_index; } - m_cfg.pwmctrl[pwmId]->set_pwm_duty(duty); - return 0; + return m_cfg.pwmctrl[pwmId]->set_pwm_duty(duty); } int32_t ZCanBoardModule::readPwmFreq(int32_t pwmId, int32_t &freq) { @@ -147,8 +174,7 @@ int32_t ZCanBoardModule::readPwmFreq(int32_t pwmId, int32_t &freq) { if (m_cfg.pwmctrl[pwmId] == nullptr) { return err::kmodule_not_find_config_index; } - freq = m_cfg.pwmctrl[pwmId]->get_pwm_freq(); - return 0; + return m_cfg.pwmctrl[pwmId]->get_pwm_freq(freq); } int32_t ZCanBoardModule::setPwmFreq(int32_t pwmId, int32_t freq) { if (pwmId < 0 || pwmId >= ZARRAY_SIZE(m_cfg.pwmctrl)) { @@ -157,6 +183,5 @@ int32_t ZCanBoardModule::setPwmFreq(int32_t pwmId, int32_t freq) { if (m_cfg.pwmctrl[pwmId] == nullptr) { return err::kmodule_not_find_config_index; } - m_cfg.pwmctrl[pwmId]->set_pwm_freq(freq); - return 0; + return m_cfg.pwmctrl[pwmId]->set_pwm_freq(freq); } \ No newline at end of file diff --git a/components/zcancmder/zcan_board_module.hpp b/components/zcancmder/zcan_board_module.hpp index 3524f10..0dcc2ab 100644 --- a/components/zcancmder/zcan_board_module.hpp +++ b/components/zcancmder/zcan_board_module.hpp @@ -42,8 +42,8 @@ class ZCanBoardModule : public ZIModule { hardware_config_t m_cfg; int32_t module_id; - ZGPIO m_input[16]; - ZGPIO m_output[16]; + ZGPIO m_input[32]; + ZGPIO m_output[32]; int32_t m_input_num = 0; int32_t m_output_num = 0; @@ -76,6 +76,9 @@ class ZCanBoardModule : public ZIModule { int32_t readPwmFreq(int32_t pwmId, int32_t &freq); int32_t setPwmFreq(int32_t pwmId, int32_t freq); + + int32_t setPwmState(int32_t pwmId, int32_t state); + int32_t getPwmState(int32_t pwmId, int32_t &state); }; } // namespace iflytop \ No newline at end of file diff --git a/components/zcancmder/zcanreceiver.cpp b/components/zcancmder/zcanreceiver.cpp index 299d0dd..f86d834 100644 --- a/components/zcancmder/zcanreceiver.cpp +++ b/components/zcancmder/zcanreceiver.cpp @@ -348,6 +348,7 @@ void ZCanCmder::loop() { dataoff += rxbuf->m_canPacket[i].dlc; } rxbuf->rxdataSize = dataoff; + // ZLOGI(TAG,"rx packet"); for (auto &var : m_listenerList) { if (var) var->onRceivePacket(rxbuf->get_cmdheader(), rxbuf->get_params(), rxbuf->get_params_len()); diff --git a/components/zcancmder_module/zcan_basic_order_module.cpp b/components/zcancmder_module/zcan_basic_order_module.cpp deleted file mode 100644 index 4057165..0000000 --- a/components/zcancmder_module/zcan_basic_order_module.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "zcan_basic_order_module.hpp" - -#include -#include -#ifdef HAL_CAN_MODULE_ENABLED - -using namespace iflytop; -using namespace zcr; -#if 0 -void ZCanBasicOrderModule::initialize(ZCanCmder* zcanReceiver) { - zcanReceiver->registerListener(this); - m_zcanReceiver = zcanReceiver; -} -#if 0 -void ZCanBasicOrderModule::reg_read_io(readfn_t fn) { m_readfn = fn; } -void ZCanBasicOrderModule::reg_set_io(writefn_t fn) { m_writefn = fn; } -void ZCanBasicOrderModule::reg_read_adc(readadcval_t fn) { m_readadcval = fn; } -#endif -void ZCanBasicOrderModule::reg_read_io(uint8_t id, readfn_t fn) { m_inputCtlMap[id] = fn; } -void ZCanBasicOrderModule::reg_set_io(uint8_t id, writefn_t fn) { m_outCtlMap[id] = fn; } -void ZCanBasicOrderModule::reg_read_adc(uint8_t id, readadcval_t fn) { m_readAdcValMap[id] = fn; } - -void ZCanBasicOrderModule::onRceivePacket(CanPacketRxBuffer* rxbuf) { - if (rxbuf->iscmd(kcmd_ping)) { - kcmd_ping_cmd_t* pingcmd = rxbuf->get_param_as(); - kcmd_ping_ack_t* ack = (kcmd_ping_ack_t*)txbuff; - - if (pingcmd->boardid == m_zcanReceiver->getDeviceId()) { - ack->boardid = pingcmd->boardid; - m_zcanReceiver->sendAck(rxbuf->get_cmdheader(), txbuff, sizeof(kcmd_ping_ack_t)); - return; - } - } else if (rxbuf->iscmd(kcmd_read_io)) { - kcmd_read_io_cmd_t* cmd = rxbuf->get_param_as(); - kcmd_read_io_ack_t* ack = (kcmd_read_io_ack_t*)txbuff; - bool val = false; - - if (m_inputCtlMap.find(cmd->ioid) != m_inputCtlMap.end()) { - val = m_inputCtlMap[cmd->ioid](); - ack->ioid = cmd->ioid; - ack->val = val; - m_zcanReceiver->sendAck(rxbuf->get_cmdheader(), txbuff, sizeof(kcmd_read_io_ack_t)); - } - - } else if (rxbuf->iscmd(kcmd_set_io)) { - kcmd_set_io_cmd_t* cmd = rxbuf->get_param_as(); - kcmd_set_io_ack_t ack; - bool val = cmd->val; - - if (m_outCtlMap.find(cmd->ioid) != m_outCtlMap.end()) { - m_outCtlMap[cmd->ioid](val); - ack.ioid = cmd->ioid; - ack.val = val; - m_zcanReceiver->sendAck(rxbuf->get_cmdheader(), (uint8_t*)&ack, sizeof(ack)); - return; - } - - } else if (rxbuf->iscmd(kcmd_readadc_raw)) { - kcmd_readadc_raw_cmd_t* cmd = rxbuf->get_param_as(); - kcmd_readadc_raw_ack_t ack; - int32_t val = 0; - if (m_readAdcValMap.find(cmd->sensorid) != m_readAdcValMap.end()) { - val = m_readAdcValMap[cmd->sensorid](); - ack.sensorid = cmd->sensorid; - ack.val = val; - m_zcanReceiver->sendAck(rxbuf->get_cmdheader(), (uint8_t*)&ack, sizeof(ack)); - return; - } - } -} - -void ZCanBasicOrderModule::loop() {} - -#endif -#endif \ No newline at end of file diff --git a/components/zcancmder_module/zcan_basic_order_module.hpp b/components/zcancmder_module/zcan_basic_order_module.hpp deleted file mode 100644 index 71dd8e1..0000000 --- a/components/zcancmder_module/zcan_basic_order_module.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// Created by zwsd -// - -#pragma once -// -#include "sdk/os/zos.hpp" -#include "sdk\components\zcancmder\zcanreceiver.hpp" -#ifdef HAL_CAN_MODULE_ENABLED -#include - -namespace iflytop { -using namespace std; -#if 0 -class ZCanBasicOrderModule : public ZCanCmderListener { - public: - private: - ZCanCmder* m_zcanReceiver; - - typedef function readfn_t; - typedef function writefn_t; - typedef function readadcval_t; - - // readfn_t m_readfn; - // writefn_t m_writefn; - // readadcval_t m_readadcval; - - uint8_t txbuff[32]; - - map m_inputCtlMap; - map m_outCtlMap; - map m_readAdcValMap; - - public: - ZCanBasicOrderModule(/* args */) {} - ~ZCanBasicOrderModule() {} - - public: - void initialize(ZCanCmder* zcanReceiver); - - void reg_read_io(uint8_t id, readfn_t fn); - void reg_set_io(uint8_t id, writefn_t fn); - void reg_read_adc(uint8_t id, readadcval_t fn); - - public: - virtual void onRceivePacket(CanPacketRxBuffer* rxbuf); - - private: - void loop(); -}; -#endif -} // namespace iflytop - -#endif \ No newline at end of file diff --git a/components/zcancmder_module/zcan_eeprom_module.cpp b/components/zcancmder_module/zcan_eeprom_module.cpp deleted file mode 100644 index ed58466..0000000 --- a/components/zcancmder_module/zcan_eeprom_module.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "zcan_eeprom_module.hpp" -using namespace iflytop; - -#define TAG "ZCanEepromModule" -#if 0 -void ZCanEepromModule::initialize(ZCanCmder* cancmder, int id, I_EEPROMModule* module) { - m_cancmder = cancmder; - m_id = id; - m_module = module; - m_lock.init(); - cancmder->registerListener(this); -} -void ZCanEepromModule::onRceivePacket(CanPacketRxBuffer* rxcmd) { // - - PROCESS_PACKET(kcmd_eeprom_start_monitor_status, m_id) { - errorcode = m_module->start_monitor_status([this, cmdheader](I_EEPROMModule::eeprom_status_t& status) { // - auto* report = (kcmd_eeprom_start_monitor_status_report_t*)m_txbuf; - static_assert(sizeof(*report) < sizeof(m_txbuf), "report size too large"); - - ZLOGI(TAG, "kcmd_eeprom_start_monitor_status exec_status:%d", status); - report->status = status; - m_cancmder->sendStatusReport(cmdheader, (uint8_t*)report, sizeof(*report)); - }); - }; - END_PP(); - - PROCESS_PACKET(kcmd_eeprom_stop_monitor_status, m_id) { errorcode = m_module->stop_monitor_status(); }; - END_PP(); - - PROCESS_PACKET(kcmd_eeprom_read_block, m_id) { errorcode = m_module->read(cmd->sector_index, cmd->sector_size, ack->ack); }; - END_PP(); -} -#endif diff --git a/components/zcancmder_module/zcan_eeprom_module.hpp b/components/zcancmder_module/zcan_eeprom_module.hpp deleted file mode 100644 index 9afe630..0000000 --- a/components/zcancmder_module/zcan_eeprom_module.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -// #include "sdk/components/zprotocols/zcancmder/api/i_step_motor_ctrl_module.hpp" -#include "sdk/components/zprotocols/zcancmder/api/i_eeprom.hpp" -#include "sdk\components\zcancmder\zcanreceiver.hpp" -namespace iflytop { - -#if 0 -class ZCanEepromModule : public ZCanCmderListener { - ZCanCmder* m_cancmder = nullptr; - int m_id = 0; - I_EEPROMModule* m_module; - - uint8_t m_txbuf[300] = {0}; - zmutex m_lock; - - public: - void initialize(ZCanCmder* cancmder, int id, I_EEPROMModule* module); - virtual void onRceivePacket(CanPacketRxBuffer* rxcmd); -}; -#endif -} // namespace iflytop diff --git a/components/zcancmder_module/zcan_fan_ctrl_module.cpp b/components/zcancmder_module/zcan_fan_ctrl_module.cpp deleted file mode 100644 index fd7ba31..0000000 --- a/components/zcancmder_module/zcan_fan_ctrl_module.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "zcan_fan_ctrl_module.hpp" -using namespace iflytop; -using namespace std; -#if 1 -#define TAG "ZcanFanCtrlModule" -void ZcanFanCtrlModule::initialize(int32_t id, ZIPWMFanCtrlModule* fanmodule, int32_t default_speed) { - m_id = id; - m_fanmodule = fanmodule; - ZASSERT(m_fanmodule != nullptr); - - OSDefaultSchduler::getInstance()->regPeriodJob( - [this](OSDefaultSchduler::Context& context) { // - if (m_isworking && m_com_reg.module_errorcode == 0) { - if (m_fanmodule->isError()) { - ZLOGE(TAG, "detect fan error,stop fan"); - m_com_reg.module_errorcode = err::khwardware_error; - m_fanmodule->clearError(); - module_stop(); - } - } - }, - 10); -} - -int32_t ZcanFanCtrlModule::getid(int32_t* id) { - *id = m_id; - return 0; -} -int32_t ZcanFanCtrlModule::module_get_status(int32_t* status) { - if (m_com_reg.module_errorcode != 0) { - *status = 2; - } else if (m_isworking) { - *status = 1; - } else { - *status = 0; - } - return 0; -} -int32_t ZcanFanCtrlModule::set_fan_default_speed(int32_t default_speed) { - m_default_speed = default_speed; - if (m_isworking) m_fanmodule->setFanSpeed(default_speed); - return 0; -} - -int32_t ZcanFanCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t& val) { - switch (param_id) { - MODULE_COMMON_PROCESS_REG_CB(); - PROCESS_REG(kreg_fan0_ctrl_speed_level, REG_GET(m_default_speed), set_fan_default_speed(val)); - break; - default: - return err::kmodule_not_find_config_index; - } - return err::kmodule_not_find_config_index; -} - -int32_t ZcanFanCtrlModule::module_stop() { - m_isworking = false; - m_fanmodule->stop(); - return 0; -} -int32_t ZcanFanCtrlModule::module_start() { - module_clear_error(); - - if (m_default_speed == 0) { - module_stop(); - } - - m_isworking = true; - m_fanmodule->setFanSpeed(m_default_speed); - return 0; -} - -int32_t ZcanFanCtrlModule::do_action(int32_t actioncode) { return 0; } -#endif \ No newline at end of file diff --git a/components/zcancmder_module/zcan_fan_ctrl_module.hpp b/components/zcancmder_module/zcan_fan_ctrl_module.hpp deleted file mode 100644 index 4d26381..0000000 --- a/components/zcancmder_module/zcan_fan_ctrl_module.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once -/** - * @file tmp117.hpp - * @author zhaohe (h_zhaohe@163.com) - * @brief - * @version 0.1 - * @date 2023-04-14 - * - * @copyright Copyright (c) 2023 - * - * - * 1. 参考:https://github.com/rkiyak/TMP117.git - * 2. 同级目录有芯片的datasheet。 - */ -#include - -#include "sdk/os/zos.hpp" -// -#include "sdk\components\api\zi_pwm_fan_ctrl_module.hpp" -#include "sdk\components\zprotocols\zcancmder_v2\api\api.hpp" - -namespace iflytop { -/** - * @brief - * 水冷温度控制模块 - */ - -class ZcanFanCtrlModule : public ZIModule { - ENABLE_MODULE(ZcanFanCtrlModule, kfan_ctrl_module, 1); - - public: - ZIPWMFanCtrlModule* m_fanmodule = nullptr; - int32_t m_id = 0; - - bool m_isworking = false; - - int32_t m_default_speed = 50; - - public: - ZcanFanCtrlModule(){}; - virtual ~ZcanFanCtrlModule(){}; - - void initialize(int32_t id, ZIPWMFanCtrlModule* fanmodule, int32_t default_speed); - - virtual int32_t getid(int32_t* id) override; - virtual int32_t module_get_status(int32_t* status) override; - virtual int32_t module_start() override; - virtual int32_t module_stop() override; - virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& val) override; - - public: - virtual int32_t set_fan_default_speed(int32_t default_speed); - virtual int32_t do_action(int32_t actioncode) override; -}; - -} // namespace iflytop diff --git a/components/zcancmder_module/zcan_mini_servo_ctrl_module.cpp b/components/zcancmder_module/zcan_mini_servo_ctrl_module.cpp deleted file mode 100644 index dce2fb2..0000000 --- a/components/zcancmder_module/zcan_mini_servo_ctrl_module.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "zcan_mini_servo_ctrl_module.hpp" -using namespace iflytop; -#if 0 - -#endif \ No newline at end of file diff --git a/components/zcancmder_module/zcan_mini_servo_ctrl_module.hpp b/components/zcancmder_module/zcan_mini_servo_ctrl_module.hpp deleted file mode 100644 index 8e675b6..0000000 --- a/components/zcancmder_module/zcan_mini_servo_ctrl_module.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#include "sdk/components/zprotocols/zcancmder/api/i_mini_servo_module.hpp" -#include "sdk\components\zcancmder\zcanreceiver.hpp" -namespace iflytop { - -} // namespace iflytop diff --git a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp index 1d663dc..9b5ca7c 100644 --- a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp +++ b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.cpp @@ -109,7 +109,7 @@ void MicroComputerModuleDeviceScriptCmderPaser::app_dump_reg(int moduleId, const if (ecode == 0) { if (type == kint) { ZLOGI(TAG, "%s(%d) :%d", configtag, configid, configval); - } else if (type == kint) { + } else if (type == kbit) { ZLOGI(TAG, "%s(%d) :%s", configtag, configid, dumpbit(configval)); } } else if (ecode != err::kmodule_not_find_config_index) {