Browse Source

update

master
zhaohe 2 years ago
parent
commit
9810ca648d
  1. 6
      Intelligent_winding_robot_main_board.launch
  2. 2
      sdk
  3. 50
      usrc/main.cpp

6
mainboard Debug.launch → Intelligent_winding_robot_main_board.launch

@ -21,7 +21,7 @@
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/> <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/> <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="168000000"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="144000000"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/> <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/> <stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/> <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
@ -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.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.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/> <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="0046002C3132510838363431"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/> <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"/> <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}]}"/> <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 d69f8551a6307b256cb2917312e57e2949953db1
Subproject commit 40d6da40267dc39bcff6b282dd6ed6e7da4408df

50
usrc/main.cpp

@ -10,8 +10,11 @@
#include "sdk\components\eq_20_asb_motor\eq20_servomotor.hpp" #include "sdk\components\eq_20_asb_motor\eq20_servomotor.hpp"
#include "sdk\components\iflytop_can_slave_module_master_end\stepmotor.hpp" #include "sdk\components\iflytop_can_slave_module_master_end\stepmotor.hpp"
#include "sdk\components\iflytop_can_slave_v1\iflytop_can_master.hpp" #include "sdk\components\iflytop_can_slave_v1\iflytop_can_master.hpp"
#include "sdk\components\scriptcmder_module\xy_robot_script_cmder_module.hpp"
#include "sdk\components\step_motor_45\step_motor_45.hpp" #include "sdk\components\step_motor_45\step_motor_45.hpp"
#include "sdk\components\step_motor_45\step_motor_45_scheduler.hpp" #include "sdk\components\step_motor_45\step_motor_45_scheduler.hpp"
#include "sdk\components\zcancmder\zcanreceiver_master.hpp"
#include "sdk\components\zcancmder_master_module\zcan_xy_robot_master_module.hpp"
#define TAG "main" #define TAG "main"
namespace iflytop { namespace iflytop {
@ -120,14 +123,17 @@ static StepMotor45::cfg_t cfg6 = {
* ´úÂë * * ´úÂë *
*******************************************************************************/ *******************************************************************************/
namespace iflytop { namespace iflytop {
StepMotor45 g_step_motor45[7];
StepMotor g_step_motor[10];
IflytopCanMaster m_IflytopCanMaster;
CmdScheduler cmdScheduler;
ModbusBlockHost g_modbusblockhost;
Eq20ServoMotor g_eq20servomotor;
FeiTeServoMotor g_feiteservomotor;
StepMotor45 g_step_motor45[7];
StepMotor g_step_motor[10];
ZCanCommnaderMaster m_zcanCommnaderMaster;
CmdScheduler cmdScheduler;
XYRobotScriptCmderModule xyRobotScriptCmderModule;
ModbusBlockHost g_modbusblockhost;
Eq20ServoMotor g_eq20servomotor;
FeiTeServoMotor g_feiteservomotor;
I_XYRobotCtrlModule* g_xyrobotctrlmodule = nullptr;
} // namespace iflytop } // namespace iflytop
void regfn() { void regfn() {
@ -182,6 +188,11 @@ void regfn() {
CHECK_ARGC(1); CHECK_ARGC(1);
osDelay(atoi(argv[1])); osDelay(atoi(argv[1]));
}); });
cmdScheduler.registerCmd("hbot_enable", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) {
CHECK_ARGC(0);
g_xyrobotctrlmodule->enable(false);
});
} }
extern "C" { extern "C" {
@ -201,9 +212,18 @@ void Main::run() {
zos_cfg_t zoscfg; zos_cfg_t zoscfg;
zos_init(&zoscfg); zos_init(&zoscfg);
auto config = m_IflytopCanMaster.createDefaultConfig(1);
m_IflytopCanMaster.initialize(config);
auto* cfg = m_zcanCommnaderMaster.createCFG();
m_zcanCommnaderMaster.init(cfg);
g_xyrobotctrlmodule = zcancmder_master::create_xyrobot_ctrl_module(&m_zcanCommnaderMaster, 1);
g_xyrobotctrlmodule->enable(false);
cmdScheduler.initialize(&DEBUG_UART, 1000);
xyRobotScriptCmderModule.initialize(&cmdScheduler);
xyRobotScriptCmderModule.regXYRobot(1, g_xyrobotctrlmodule);
regfn();
#if 0
int i = 1; int i = 1;
g_step_motor[i++].initialize(11, 10000, &m_IflytopCanMaster); g_step_motor[i++].initialize(11, 10000, &m_IflytopCanMaster);
g_step_motor[i++].initialize(12, 10000, &m_IflytopCanMaster); g_step_motor[i++].initialize(12, 10000, &m_IflytopCanMaster);
@ -232,20 +252,18 @@ void Main::run() {
step_motor45_scheduler.start(); step_motor45_scheduler.start();
cmdScheduler.initialize(&DEBUG_UART, 1000);
g_modbusblockhost.initialize(&huart2); g_modbusblockhost.initialize(&huart2);
g_eq20servomotor.init(&g_modbusblockhost); g_eq20servomotor.init(&g_modbusblockhost);
g_feiteservomotor.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx); g_feiteservomotor.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx);
#endif
#if 0
step_motor_cmd_reg(); step_motor_cmd_reg();
regfn();
#endif
while (true) { while (true) {
OSDefaultSchduler::getInstance()->loop(); OSDefaultSchduler::getInstance()->loop();
cmdScheduler.schedule(); cmdScheduler.schedule();
m_IflytopCanMaster.periodicJob();
// m_IflytopCanMaster.writeReg(1,1,1,10);
// osDelay(1);
osDelay(1);
} }
} }
Loading…
Cancel
Save