Browse Source

update

master
zhaohe 1 year ago
parent
commit
7ec037054a
  1. 2
      a8000_protocol
  2. 2
      sdk
  3. 2
      usrc/subboards/subboard100_idcard_reader/eeprom_service.cpp
  4. 7
      usrc/subboards/subboard100_idcard_reader/eeprom_service.hpp
  5. 46
      usrc/subboards/subboard90_optical_module/optical_module.cpp
  6. 29
      usrc/subboards/subboard90_optical_module/optical_module.hpp
  7. 98
      usrc/subboards/subboard90_optical_module/pri_board.h

2
a8000_protocol

@ -1 +1 @@
Subproject commit c6a2a14eb08bbd60018e24b866a874db6d6dff80
Subproject commit 1d75c687904a843514be39cbb4b379ffc0aa2414

2
sdk

@ -1 +1 @@
Subproject commit 74ab9d32d67b4c0b8d1afb63b0421e0c11a924e5
Subproject commit e73bbb727cbc87ea0ddcd64c0a9a7d48fb7bd8f8

2
usrc/subboards/subboard100_idcard_reader/eeprom_service.cpp

@ -133,7 +133,7 @@ void EEPROMService::detect_online() {
}
}
int32_t EEPROMService::module_read_raw(int32_t index, uint8_t* data, int32_t* len) {
int32_t EEPROMService::a8000_idcard_reader_read_raw(int32_t index, uint8_t* data, int32_t* len) {
zlock_guard guard(m_mutex);
if (!m_nowonline) return err::kdevice_offline;
if (*len < SECTOR_SIZE) return err::kbuffer_not_enough;

7
usrc/subboards/subboard100_idcard_reader/eeprom_service.hpp

@ -19,8 +19,8 @@ using namespace std;
* 2. eeprom的容积为2kbyte
*/
class EEPROMService : public ZIModule {
ENABLE_MODULE(EEPROMService,ka8000_idcard_reader,PC_VERSION)
class EEPROMService : public ZIModule, public ZIA8000IDCardReaderModule {
ENABLE_MODULE(EEPROMService, ka8000_idcard_reader, PC_VERSION)
I2C_HandleTypeDef* m_i2c_handle;
ZThread m_monitor_thread;
bool m_is_online_flag = false;
@ -46,6 +46,8 @@ class EEPROMService : public ZIModule {
void initialize(int id, I2C_HandleTypeDef* i2c_handle, ZIEventBusSender* event_bus_sender);
public:
virtual int32_t a8000_idcard_reader_read_raw(int32_t index, uint8_t* data, int32_t* len) override;
int32_t start_monitor_status();
int32_t stop_monitor_status();
@ -59,7 +61,6 @@ class EEPROMService : public ZIModule {
*id = this->id;
return 0;
}
virtual int32_t module_read_raw(int32_t index, uint8_t* data, int32_t* len);
private:
virtual int32_t module_get_status(int32_t* status) override;

46
usrc/subboards/subboard90_optical_module/optical_module.cpp

@ -83,10 +83,6 @@ int32_t OpticalModule::module_get_status(int32_t* status) {
return 0;
}
int32_t OpticalModule::module_factory_reset() { return 0; }
int32_t OpticalModule::module_flush_cfg() { return 0; }
int32_t OpticalModule::module_active_cfg() { return 0; }
/**
* @brief F光学
*
@ -213,13 +209,8 @@ int32_t OpticalModule::adjust_detector_gain() {
int32_t OpticalModule::module_xxx_reg(int32_t param_id, bool read, int32_t& val) {
switch (param_id) {
MODULE_COMMON_PROCESS_REG_CB();
// PROCESS_REG(kreg_module_version, /* */ REG_GET(0x0001), ACTION_NONE);
// PROCESS_REG(kreg_module_type, /* */ REG_GET(0), ACTION_NONE);
// PROCESS_REG(kreg_module_do_action0, /* */ ACTION_NONE, do_action(val));
PROCESS_REG(kreg_laster_scaner_raw_sector_size, raw_get_sector_size(&val), ACTION_NONE);
PROCESS_REG(kreg_laster_scaner_raw_sector_num, raw_get_sector_num(&val), ACTION_NONE);
PROCESS_REG(kreg_boditech_optical_module_raw_sector_size, raw_get_sector_size(&val), ACTION_NONE);
PROCESS_REG(kreg_boditech_optical_module_raw_sector_num, raw_get_sector_num(&val), ACTION_NONE);
PROCESS_REG(kreg_boditech_optical_scan_type, REG_GET(m_reg.scan_type), REG_SET(m_reg.scan_type));
PROCESS_REG(kreg_boditech_optical_scan_start_pos, REG_GET(m_reg.scan_start_pos), REG_SET(m_reg.scan_start_pos));
PROCESS_REG(kreg_boditech_optical_scan_direction, REG_GET(m_reg.scan_direction), REG_SET(m_reg.scan_direction));
@ -236,12 +227,6 @@ int32_t OpticalModule::module_xxx_reg(int32_t param_id, bool read, int32_t& val)
PROCESS_REG(kreg_boditech_optical_scan_gain_adjust_suggestion, REG_GET(m_reg.scan_gain_adjust_suggestion), ACTION_NONE);
PROCESS_REG(kreg_boditech_optical_adc_result_overflow, REG_GET(m_reg.adc_result_overflow), ACTION_NONE);
PROCESS_REG(kreg_boditech_optical_laster_intensity, REG_GET(m_reg.laster_intensity), ACTION_NONE);
// PROCESS_REG(kreg_module_action_param1, /* */ REG_GET(m_reg.module_action_param1), REG_SET(m_reg.module_action_param1));
// PROCESS_REG(kreg_module_action_param2, /* */ REG_GET(m_reg.module_action_param2), REG_SET(m_reg.module_action_param2));
// PROCESS_REG(kreg_module_action_param3, /* */ REG_GET(m_reg.module_action_param3), REG_SET(m_reg.module_action_param3));
// PROCESS_REG(kreg_module_action_ack1, /* */ REG_GET(m_reg.module_action_ack1), ACTION_NONE);
// PROCESS_REG(kreg_module_action_ack2, /* */ REG_GET(m_reg.module_action_ack2), ACTION_NONE);
default:
return err::kmodule_not_find_reg;
break;
@ -257,18 +242,15 @@ int32_t OpticalModule::do_action(int32_t action) {
} else if (action == ACTION_CLOSE_LASER) {
return a8000_optical_close_laser(m_reg.scan_type);
} else if (action == ACTION_READ_SCAN_ADC) {
// TODO:
// int32_t ret = a8000_optical_read_scanner_adc_val(m_reg.scan_type, &m_com_reg.module_action_ack1);
return 0;
// return ret;
return err::kparam_out_of_range;
} else if (action == ACTION_READ_LASTER_ADC) {
// TODO:
// return a8000_optical_read_laster_adc_val(m_reg.scan_type, &m_com_reg.module_action_ack1);
return 0;
// return a8000_optical_read_laster_adc_val(m_reg.scan_type, &m_com_reg.module_action_ack1);
return err::kparam_out_of_range;
} else if (action == ACTION_READ_ONE_POINT) {
// TODO:
// return a8000_optical_scan_current_point_amp_adc_val(m_reg.scan_type, m_com_reg.module_action_param1, m_com_reg.module_action_param2, &m_com_reg.module_action_ack1, &m_com_reg.module_action_ack2);
return 0;
// return a8000_optical_scan_current_point_amp_adc_val(m_reg.scan_type, m_com_reg.module_action_param1, m_com_reg.module_action_param2, &m_com_reg.module_action_ack1, &m_com_reg.module_action_ack2);
return err::kparam_out_of_range;
} else if (action == ACTION_SET_LASTER_GAIN) {
return a8000_optical_set_laster_gain(m_reg.scan_type, m_reg.laster_gain);
} else if (action == ACTION_SET_SCANER_GAIN) {
@ -283,18 +265,14 @@ int32_t OpticalModule::do_action(int32_t action) {
} else if (action == ACTION_DUMP_RESULT) {
return dumpresult();
}
return err::kcmd_not_support;
return err::kparam_out_of_range;
}
int32_t OpticalModule::module_stop() {
m_thread.stop();
return 0;
}
int32_t OpticalModule::module_break() {
m_thread.stop();
return 0;
}
int32_t OpticalModule::module_start() {
int32_t OpticalModule::a8000_optical_start_capture() {
if (m_reg.scan_type == 0) { // main,f光学
return start_f_optical_scan();
} else if (m_reg.scan_type == 1) { // trf,t光学
@ -304,6 +282,8 @@ int32_t OpticalModule::module_start() {
}
return 0;
}
// virtual int32_t a8000_optical_start_capture();
// virtual int32_t a8000_optical_read_raw(int32_t index, uint8_t* data, int32_t* len);
int32_t OpticalModule::start_t_optical_scan() {
m_thread.stop();
@ -466,7 +446,7 @@ int32_t OpticalModule::raw_get_sector_num(int32_t* val) {
}
return 0;
}
int32_t OpticalModule::module_read_raw(int32_t index, uint8_t* data, int32_t* len) {
int32_t OpticalModule::a8000_optical_read_raw(int32_t index, uint8_t* data, int32_t* len) {
int32_t sector_size = RAW_SECTION_SIZE;
int32_t rawsize = adc_capture_point_num * 2;

29
usrc/subboards/subboard90_optical_module/optical_module.hpp

@ -114,18 +114,14 @@ class OpticalModule : public ZIModule, public ZIA8000OpticalModule {
return 0;
}
virtual int32_t module_ping() { return 0; }
virtual int32_t module_stop() override;
virtual int32_t module_break(); // TODO
virtual int32_t module_start(); // TODO
virtual int32_t module_factory_reset(); // TODO
virtual int32_t module_flush_cfg(); //
virtual int32_t module_active_cfg() override;
virtual int32_t module_get_status(int32_t* status) override;
virtual int32_t module_read_raw(int32_t index, uint8_t* data, int32_t* len); // TODO
/***********************************************************************************************************************
* opt *
***********************************************************************************************************************/
virtual int32_t a8000_optical_start_capture() override;
virtual int32_t a8000_optical_read_raw(int32_t index, uint8_t* data, int32_t* len) override;
virtual int32_t a8000_optical_open_laser(int32_t type) override;
virtual int32_t a8000_optical_close_laser(int32_t type) override;
@ -134,7 +130,6 @@ class OpticalModule : public ZIModule, public ZIA8000OpticalModule {
virtual int32_t a8000_optical_read_scanner_adc_val(int32_t type, int32_t* adcval) override;
virtual int32_t a8000_optical_read_laster_adc_val(int32_t type, int32_t* adcval) override;
virtual int32_t a8000_optical_module_power_ctrl(int32_t state) override;
private:
int32_t start_t_optical_scan();
int32_t start_f_optical_scan();
@ -146,20 +141,6 @@ class OpticalModule : public ZIModule, public ZIA8000OpticalModule {
int32_t dumpresult();
#if 0
void t_open_laser();
void t_close_laser();
void t_set_laster_gain(int32_t gain);
void t_set_scan_amp_gain(int32_t gain);
void f_open_laser();
void f_close_laser();
void f_set_laster_gain(int32_t gain);
void f_set_scan_amp_gain(int32_t gain);
void select_f_channel();
#endif
int32_t move_to_block(int32_t pos);
virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t& val) override;
void opt_module_power_ctrl(bool on);

98
usrc/subboards/subboard90_optical_module/pri_board.h

@ -3,12 +3,13 @@
/***********************************************************************************************************************
* IO *
***********************************************************************************************************************/
#define EXT_INPUT_IO0 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO1 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO2 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO3 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO4 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO5 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO0 PD8, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false
#define EXT_INPUT_IO1 PD9, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false
#define EXT_INPUT_IO2 PD10, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false
#define EXT_INPUT_IO3 PD11, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false
#define EXT_INPUT_IO4 PD12, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false
#define EXT_INPUT_IO5 PD13, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false
#define EXT_INPUT_IO6 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO7 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
#define EXT_INPUT_IO8 PinNull, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true
@ -28,33 +29,56 @@
#define TMC_MOTOR_SPI hspi1
/***********************************************************************************************************************
* *
* *
***********************************************************************************************************************/
#define MOTOR1_CSN PA4
#define MOTOR1_ENN PE3
#define MOTOR1_ENN PD5
#define MOTOR1_SPI_MODE_SELECT PinNull
#define MOTOR1_nFREEZE_IO PE12
#define MOTOR1_nFREEZE_IO PinNull
#define MOTOR1_nRESET_IO PinNull
#define MOTOR1_SUB_IC_ENN_IO PE11
#define MOTOR1_SUB_IC_ENN_IO PinNull
#define MOTOR1_REFL PD2
#define MOTOR1_REFR PD1
#define MOTOR1_REFL PD0
#define MOTOR1_REFR PinNull
#define MOTOR1_REFL_MIRROR true
#define MOTOR1_REFR_MIRROR true
#define MOTOR1_MOTOR_SHAFT false
#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE 80
#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1
#define MOTOR1_STEPMOTOR_IHOLD 1
#define MOTOR1_STEPMOTOR_IRUN 8
#define MOTOR1_STEPMOTOR_IHOLDDELAY 100
/**
* @brief
*
*
* :
* :1.2192mm
* :48
* :2
*
* ,1.2192mm/48/2 = 0.0127mm
*
* :
* 2mm
* :200
* :256
*
* :
* 2mm/motor_one_circle_pulse = 0.0127mm ()
* motor_one_circle_pulse = 2mm/0.0127mm = 157.48031496062992125984251968504
*
* motor_one_circle_pulse = 1574803
* motor_one_circle_pulse_denominator = 10000
*/
#define MOTOR1_MOTOR_SHAFT true
#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE 1574803
#define MOTOR1_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 10000
#define MOTOR1_STEPMOTOR_IHOLD 3
#define MOTOR1_STEPMOTOR_IRUN 15
#define MOTOR1_STEPMOTOR_IHOLDDELAY 1000
#define MOTOR1_STEPMOTOR_IGLOBALSCALER 0
#define MOTOR1_MOTOR_DEFAULT_VELOCITY 500
#define MOTOR1_MIN_D TMC5130_DEFAULT__MIN_D
#define MOTOR1_MAX_D TMC5130_DEFAULT__MAX_D
#define MOTOR1_MOTOR_RUN_TO_ZERO_SPEED 100
#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED 50
#define MOTOR1_MOTOR_DEFAULT_VELOCITY 600
#define MOTOR1_MIN_D 0
#define MOTOR1_MAX_D 0
#define MOTOR1_MOTOR_RUN_TO_ZERO_SPEED 600
#define MOTOR1_MOTOR_LOOK_ZERO_EDGE_SPEED 100
#define MOTOR1_MOTOR_VSTART TMC5130_DEFAULT__MOTOR_VSTART
#define MOTOR1_MOTOR_A1 TMC5130_DEFAULT__MOTOR_A1
#define MOTOR1_MOTOR_AMAX 300
@ -65,33 +89,33 @@
#define MOTOR1_MOTOR_TZEROWAIT TMC5130_DEFAULT__MOTOR_TZEROWAIT
/***********************************************************************************************************************
* *
* *
***********************************************************************************************************************/
#define MOTOR2_CSN PA4
#define MOTOR2_ENN PE3
#define MOTOR2_CSN PB1
#define MOTOR2_ENN PD4
#define MOTOR2_SPI_MODE_SELECT PinNull
#define MOTOR2_nFREEZE_IO PE12
#define MOTOR2_nFREEZE_IO PinNull
#define MOTOR2_nRESET_IO PinNull
#define MOTOR2_SUB_IC_ENN_IO PE11
#define MOTOR2_SUB_IC_ENN_IO PinNull
#define MOTOR2_REFL PD2
#define MOTOR2_REFR PD1
#define MOTOR2_REFR PD8
#define MOTOR2_REFL_MIRROR true
#define MOTOR2_REFR_MIRROR true
#define MOTOR2_MOTOR_SHAFT false
#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE 80
#define MOTOR2_MOTOR_SHAFT true
#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE 20
#define MOTOR2_MOTOR_ONE_CIRCLE_PULSE_DENOMINATOR 1
#define MOTOR2_STEPMOTOR_IHOLD 1
#define MOTOR2_STEPMOTOR_IRUN 8
#define MOTOR2_STEPMOTOR_IHOLDDELAY TMC5130_DEFAULT__STEPMOTOR_IHOLDDELAY
#define MOTOR2_STEPMOTOR_IHOLD 3
#define MOTOR2_STEPMOTOR_IRUN 15
#define MOTOR2_STEPMOTOR_IHOLDDELAY 1000
#define MOTOR2_STEPMOTOR_IGLOBALSCALER 0
#define MOTOR2_MOTOR_DEFAULT_VELOCITY 500
#define MOTOR2_MOTOR_DEFAULT_VELOCITY 600
#define MOTOR2_MIN_D TMC5130_DEFAULT__MIN_D
#define MOTOR2_MAX_D TMC5130_DEFAULT__MAX_D
#define MOTOR2_MOTOR_RUN_TO_ZERO_SPEED 100
#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED 50
#define MOTOR2_MOTOR_RUN_TO_ZERO_SPEED 600
#define MOTOR2_MOTOR_LOOK_ZERO_EDGE_SPEED 100
#define MOTOR2_MOTOR_VSTART TMC5130_DEFAULT__MOTOR_VSTART
#define MOTOR2_MOTOR_A1 TMC5130_DEFAULT__MOTOR_A1
#define MOTOR2_MOTOR_AMAX 300

Loading…
Cancel
Save