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 3fe9cb1..20c41fb 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 @@ -4,6 +4,7 @@ #include #include +#include "sdk\components\zprotocols\zcancmder_v2\api\state_index.hpp" #include "sdk/os/zos.hpp" using namespace iflytop; using namespace std; @@ -29,7 +30,7 @@ void MicroComputerModuleDeviceScriptCmderPaser::do_dumpconfig(int32_t paramN, co #define DUMP_CONFIG(tag, configid) \ ecode = m_deviceManager->module_get_param(moduleId, configid, &configval); \ if (ecode != 0) { \ - ZLOGI(TAG, "%30s :%d", tag, configval); \ + ZLOGI(TAG, "%-30s :%d", tag, configval); \ } DUMP_CONFIG("motor_x_shift", kcfg_motor_x_shift); @@ -61,10 +62,36 @@ void MicroComputerModuleDeviceScriptCmderPaser::do_dumpconfig(int32_t paramN, co DUMP_CONFIG("cfg_xyrobot_robot_type", k_cfg_xyrobot_robot_type); } +void MicroComputerModuleDeviceScriptCmderPaser::do_dumpstate(int32_t paramN, const char* paraV[], ICmdParserACK* ack) { +#if 0 +typedef enum { + + kstate_module_status = STATE_INDEX(0, 0), // + kstate_module_errorcode = STATE_INDEX(0, 1), // + + kstate_motor_x_pos = STATE_INDEX(100, 0), // x偏移 + kstate_motor_y_pos = STATE_INDEX(100, 1), // y偏移 + kstate_motor_z_pos = STATE_INDEX(100, 2), // z偏移 + + kstate_motor_move = STATE_INDEX(100, 3), // 电机是否移动 + kstate_motor_enable = STATE_INDEX(100, 4), // 电机是否使能 + +} config_index_t; +#endif +} +void MicroComputerModuleDeviceScriptCmderPaser::do_dumpstate(int32_t moduleId) { + ICmdParserACK ack; + const char paraV[1][10] = {{0}}; + sprintf((char*)paraV[0], "%d", moduleId); + + do_dumpstate(1, (const char**)paraV, &ack); +} + void MicroComputerModuleDeviceScriptCmderPaser::initialize(ICmdParser* cancmder, ZModuleDeviceManager* deviceManager) { ZModuleDeviceScriptCmderPaser::initialize(cancmder, deviceManager); m_cmdParser = cancmder; m_deviceManager = deviceManager; cancmder->regCMD("dumpconfig", "dumpconfig (mid)", 1, [this](int32_t paramN, const char* paraV[], ICmdParserACK* ack) { do_dumpconfig(paramN, paraV, ack); }); + cancmder->regCMD("dumpstate", "dumpstate (mid)", 1, [this](int32_t paramN, const char* paraV[], ICmdParserACK* ack) { do_dumpstate(paramN, paraV, ack); }); } diff --git a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp index 8fff564..921325a 100644 --- a/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp +++ b/components/zprotocol_helper/micro_computer_module_device_script_cmder_paser.hpp @@ -12,6 +12,9 @@ class MicroComputerModuleDeviceScriptCmderPaser : public ZModuleDeviceScriptCmde void do_dumpconfig(int32_t paramN, const char* paraV[], ICmdParserACK* ack); void do_dumpconfig(int32_t moduleId); + + void do_dumpstate(int32_t paramN, const char* paraV[], ICmdParserACK* ack); + void do_dumpstate(int32_t moduleId); }; } // namespace iflytop diff --git a/components/zprotocols/zcancmder_v2 b/components/zprotocols/zcancmder_v2 index 0da1095..3144ce2 160000 --- a/components/zprotocols/zcancmder_v2 +++ b/components/zprotocols/zcancmder_v2 @@ -1 +1 @@ -Subproject commit 0da1095ad399f7acbe11f2f5ba166b84268c1df6 +Subproject commit 3144ce2a8f3088e7d2123e2dfb3248ef6857a478