Browse Source

update

master
zhaohe 2 years ago
parent
commit
829b5f7027
  1. 2
      sdk
  2. 20
      usrc/main.cpp

2
sdk

@ -1 +1 @@
Subproject commit 7ac96f7487c64d6e23bf4e3e3c09bc1f910ddc96
Subproject commit b3dbb159e8a0f0593bfc9088c96ae7c24edb975a

20
usrc/main.cpp

@ -2,15 +2,15 @@
#include <stdio.h>
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
#include "sdk/components/zcancmder_module/zcan_step_motor_ctrl_module.hpp"
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_script_cmder_module.hpp"
#include "sdk/components/step_motor_ctrl_module/zcan_master_step_motor_ctrl_module.hpp"
#include "sdk/components/step_motor_ctrl_module/zcan_step_motor_ctrl_module.hpp"
#include "sdk/os/zos.hpp"
#include "sdk\components\flash\zsimple_flash.hpp"
#include "sdk\components\mini_servo_motor\feite_servo_motor.hpp"
#include "sdk\components\tmc\ic\ztmc5130.hpp"
#include "sdk\components\xy_robot_ctrl_module\xy_robot_ctrl_module.hpp"
#include "sdk\components\zcancmder\zcanreceiver.hpp"
#include "sdk\components\zcancmder_module\zcan_basic_order_module.hpp"
#include "sdk\components\zcancmder_module\zcan_xy_robot_module.hpp"
//
#include "sdk\components\flash\znvs.hpp"
//
@ -62,14 +62,20 @@ void umain() {
uint8_t deviceId = getId();
ZLOGI(TAG, "deviceId:%d", deviceId);
if (deviceId == 0) {
chip_set_error();
while (true) {
osDelay(1000);
}
}
/*******************************************************************************
* NVSINIT *
*******************************************************************************/
ZNVS::ins().initialize(IFLYTOP_NVS_CONFIG_FLASH_SECTOR);
{
static I_XYRobotCtrlModule::flash_config_t cfg;
XYRobotCtrlModule::create_default_cfg(cfg);
static I_StepMotorCtrlModule::flash_config_t cfg;
StepMotorCtrlModule::create_default_cfg(cfg);
ZNVS::ins().alloc_config(MOTOR_CFG_FLASH_MARK, (uint8_t*)&cfg, sizeof(cfg));
}
ZNVS::ins().init_config();
@ -95,7 +101,7 @@ void umain() {
g_motor.rotate(0);
// g_motor.enable(false);
auto zcanCmder_cfg = g_zcanCmder.createCFG(deviceId);
auto zcanCmder_cfg = g_zcanCmder.createCFG(deviceId + ZCAN_CMD_PUBLIC_DEVICE_ID_STEP_MOTOR_BOARD_OFFEST);
g_zcanCmder.init(zcanCmder_cfg);
/*******************************************************************************
@ -145,7 +151,7 @@ void umain() {
},
1000);
//g_stepMotorCtrlModule.initialize(deviceId, &g_motor, input, ZARRAY_SIZE(input));
g_stepMotorCtrlModule.initialize(deviceId, &g_motor, input, ZARRAY_SIZE(input), "MOTOR_CFG_FLASH_MARK");
g_zcanStepMotorCtrlModule.initialize(&g_zcanCmder, 1, &g_stepMotorCtrlModule);
while (true) {

Loading…
Cancel
Save