Browse Source

编译通过

master
zwsd 3 years ago
parent
commit
a8f7e43644
  1. 1
      main/CMakeLists.txt
  2. 2
      main/ble_spp_server_demo.c
  3. 3
      main/main.c
  4. 15
      main/motor_drive.c
  5. 2
      main/port.c

1
main/CMakeLists.txt

@ -2,6 +2,7 @@ idf_component_register(SRCS #
"ble_spp_server_demo.c"
"main.c"
"motor_drive.c"
"port.c"
INCLUDE_DIRS #
"../dep/"
".")

2
main/ble_spp_server_demo.c

@ -701,7 +701,7 @@ void blerxprocess(uint8_t *rxmessage, size_t rxsize) {
}
void bleuart_schedule() {
if (s_module->has_rx_size != 0 && port_haspassedms(s_module->last_rx_ticket) > 1000) {
if (s_module->has_rx_size != 0 && port_haspassedms(s_module->last_rx_ticket) > 200) {
s_module->receive_data_processing_flag = true;
s_cb(s_module->rxbuf, s_module->has_rx_size);

3
main/main.c

@ -78,6 +78,7 @@ void blerxcb(uint8_t *rxmessage, size_t rxsize) {
}
void motor_on_event(motor_event_t event) {
//使sprintf
if (event == kRunToPosition) {
//
//
@ -94,6 +95,6 @@ void app_main(void) {
while (true) {
bleuart_schedule();
motor_module_schedule();
// motor_module_schedule();
}
}

15
main/motor_drive.c

@ -16,7 +16,7 @@ static motor_t *motor_init_structer;
/**
* @brief
*
*
* @param motor ()
*/
void motor_init(motor_t *motor) {
@ -37,7 +37,6 @@ void motor_init(motor_t *motor) {
return;
}
static double motor_drive_read_encoder();
static uint8_t motor_drive_set_packages_ctr(double position, int direction);
@ -82,7 +81,7 @@ void motor_run_to_postion(int rotation_direction, double position, int speed_lev
uint8_t checksum = 0;
uint32_t limit_speed = 0;
uint8_t buffer[14] = {0x3E, 0XA6, MOTOR_ID, 0X08, 0XED, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00};
// char *notify_err = "set size error";
// char *notify_err = "set size error";
// forward
if ((rotation_direction == 1)) {
@ -146,20 +145,20 @@ void motor_run_to_postion(int rotation_direction, double position, int speed_lev
}
// Parse receive
// motor_drive_buffer_cmd_parse(buffer);
// motor_drive_buffer_cmd_parse(buffer);
return;
}
/**
* @brief
*
*
* @param onevent
*/
void motor_reg_event_cb(motor_on_event_t onevent) { return; }
/**
* @brief
*
*
* @return double
*/
static double motor_drive_read_encoder() {
@ -189,10 +188,10 @@ static double motor_drive_read_encoder() {
/**
* @brief
*
*
* @param position
* @param direction
* @return uint8_t
* @return uint8_t
*/
static uint8_t motor_drive_set_packages_ctr(double position, int direction) {
int position_int = 0;

2
main/port.c

@ -8,4 +8,6 @@ uint32_t port_delay_ms(uint32_t ms) {
uint32_t now = port_get_ticket();
while (port_get_ticket() - now < ms) {
}
return 0;
}
Loading…
Cancel
Save