10 changed files with 83 additions and 96 deletions
-
4.settings/language.settings.xml
-
24usrc/cmdline_support.cpp
-
13usrc/cmdline_support.hpp
-
87usrc/cmdline_version.cpp
-
3usrc/cmdline_version.hpp
-
13usrc/device.cpp
-
6usrc/device.hpp
-
10usrc/main.cpp
-
2usrc/width_detecter.cpp
-
17usrc/width_detecter.hpp
@ -0,0 +1,24 @@ |
|||
#include "cmdline_support.hpp"
|
|||
using namespace iflytop; |
|||
|
|||
void CmdlineSupport::init(Device* device) { |
|||
//
|
|||
m_device = device; |
|||
|
|||
// void line_locking_solenoid_valve(bool on);
|
|||
// void blower_set_val(bool on);
|
|||
|
|||
auto* cmdlineparser = &m_device->m_uart_cmdline_parser; |
|||
cmdlineparser->registerCmd("line_locking_solenoid_valve", "(bool on)", 1, //
|
|||
[this](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|||
int val = atoi(paraV[0]); |
|||
m_device->line_locking_solenoid_valve(val); |
|||
return 0; |
|||
}); |
|||
cmdlineparser->registerCmd("blower_set_val", "(bool on)", 1, //
|
|||
[this](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|||
int val = atoi(paraV[0]); |
|||
m_device->blower_set_val(val); |
|||
return 0; |
|||
}); |
|||
} |
@ -0,0 +1,13 @@ |
|||
#pragma once
|
|||
|
|||
#include "device.hpp"
|
|||
#include "sdk/os/zos.hpp"
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
class CmdlineSupport { |
|||
Device* m_device = nullptr; |
|||
|
|||
public: |
|||
void init(Device* device); |
|||
}; |
|||
} // namespace iflytop
|
@ -1,87 +0,0 @@ |
|||
#include <stddef.h>
|
|||
#include <stdio.h>
|
|||
|
|||
#include "sdk/os/zos.hpp"
|
|||
#include "sdk\components\flash\zsimple_flash.hpp"
|
|||
#include "sdk\components\zcancmder\zcanreceiver.hpp"
|
|||
#include "sdk\components\zcancmder_module\zcan_basic_order_module.hpp"
|
|||
#include "sdk\components\zprotocols\zcancmder_v2\protocol_parser.hpp"
|
|||
//
|
|||
#include "sdk\components\flash\znvs.hpp"
|
|||
//
|
|||
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
|
|||
#include "sdk\components\cmdscheduler\cmd_scheduler_v2.hpp"
|
|||
#include "sdk\components\hardware\uart\zuart_dma_receiver.hpp"
|
|||
#include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
|
|||
#include "sdk\components\pipette_module\pipette_ctrl_module_v2.hpp"
|
|||
#include "sdk\components\sensors\m3078\m3078_code_scaner.hpp"
|
|||
#include "sdk\components\sensors\tmp117\tmp117.hpp"
|
|||
#include "sdk\components\ti\drv8710.hpp"
|
|||
#include "sdk\components\tmc\ic\ztmc5130.hpp"
|
|||
#include "sdk\components\water_cooling_temperature_control_module\pwm_ctrl_module.hpp"
|
|||
#include "sdk\components\water_cooling_temperature_control_module\water_cooling_temperature_control_module.hpp"
|
|||
#include "sdk\components\zcancmder\zcan_board_module.hpp"
|
|||
#include "sdk\components\zcancmder\zcanreceiver_master.hpp"
|
|||
#include "sdk\components\zprotocol_helper\micro_computer_module_device_script_cmder_paser.hpp"
|
|||
#include "sdk\components\zprotocols\zcancmder_v2\protocol_proxy.hpp"
|
|||
#include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_manager.hpp"
|
|||
// #include "M3078CodeScanner"
|
|||
|
|||
#define TAG "main"
|
|||
using namespace iflytop; |
|||
using namespace std; |
|||
static ZModuleDeviceManager g_zModuleDeviceManager; |
|||
static MicroComputerModuleDeviceScriptCmderPaser g_zModuleDeviceScriptCmderPaser; |
|||
static ZCanCommnaderMaster g_zcanCommnaderMaster; |
|||
static ZIProtocolProxy proxy[255]; |
|||
|
|||
void cmdline_version_main() { |
|||
chip_cfg_t chipcfg; |
|||
chipcfg.us_dleay_tim = &PC_SYS_DELAY_US_TIMER; |
|||
chipcfg.tim_irq_scheduler_tim = &PC_SYS_TIM_IRQ_SCHEDULER_TIMER; |
|||
chipcfg.huart = &PC_DEBUG_UART; |
|||
chipcfg.debuglight = PC_DEBUG_LIGHT_GPIO; |
|||
|
|||
chip_init(&chipcfg); |
|||
|
|||
zos_cfg_t zoscfg; |
|||
zos_init(&zoscfg); |
|||
|
|||
ZLOGI(TAG, "boardId:%d", 0); |
|||
|
|||
ZLOGI(TAG, "init can bus"); |
|||
auto* m_zcanCommnaderMaster_cfg = g_zcanCommnaderMaster.createCFG(); // can×ÜÏßÅäÖÃ
|
|||
g_zcanCommnaderMaster.init(m_zcanCommnaderMaster_cfg); // can×ÜÏß
|
|||
g_zModuleDeviceManager.initialize(&g_zcanCommnaderMaster); |
|||
ZLOGI(TAG, "init can bus end..."); |
|||
|
|||
static ZUARTDmaReceiver dmaUartReceiver; |
|||
static CmdSchedulerV2 cmder; |
|||
ZUARTDmaReceiver::hardware_config_t cfg = { |
|||
.huart = &PC_DEBUG_UART, |
|||
.dma_rx = &PC_DEBUG_UART_DMA_HANDLER, |
|||
.rxbuffersize = PC_DEBUG_UART_RX_BUF_SIZE, |
|||
.rxovertime_ms = 10, |
|||
}; |
|||
ZLOGI(TAG, "init cmder"); |
|||
dmaUartReceiver.initialize(&cfg); |
|||
cmder.initialize(&dmaUartReceiver); |
|||
ZLOGI(TAG, "init cmder end..."); |
|||
|
|||
ZLOGI(TAG, "init module"); |
|||
g_zModuleDeviceManager.initialize(&g_zcanCommnaderMaster); |
|||
g_zModuleDeviceScriptCmderPaser.initialize(&cmder, &g_zModuleDeviceManager); |
|||
ZLOGI(TAG, "reg modules"); |
|||
|
|||
for (size_t i = 1; i < 255; i++) { |
|||
proxy[i].initialize(i, &g_zcanCommnaderMaster); |
|||
g_zModuleDeviceManager.registerModule(&proxy[i]); |
|||
} |
|||
|
|||
ZLOGI(TAG, "board init ok..."); |
|||
|
|||
while (true) { |
|||
OSDefaultSchduler::getInstance()->loop(); |
|||
cmder.schedule(); |
|||
} |
|||
}; |
@ -1,3 +0,0 @@ |
|||
#pragma once
|
|||
void cmdline_version_main(); |
|||
|
@ -0,0 +1,2 @@ |
|||
#include "width_detecter.hpp"
|
|||
|
@ -0,0 +1,17 @@ |
|||
#pragma once
|
|||
|
|||
#include "sdk/os/zos.hpp"
|
|||
|
|||
namespace iflytop { |
|||
class WindthDetecter { |
|||
public: |
|||
void init(int32_t resetpos, int32_t zeropos, int32_t direction); |
|||
void start_direct(); |
|||
void stop(); |
|||
|
|||
int32_t get_width(); |
|||
|
|||
private: |
|||
void loop(); |
|||
}; |
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue