|
|
@ -17,6 +17,9 @@ |
|
|
|
#define MAIN_LOG_TAG "MAIN" |
|
|
|
#define ble_uart_tx_size 128 |
|
|
|
#define ble_uart_rx_size 128 |
|
|
|
#define KEY_INT1 27 |
|
|
|
#define KEY_INT2 14 |
|
|
|
#define GPIO_KEY_INPUT_PIN_SEL ((1ULL << KEY_INT1) | (1ULL << KEY_INT2)) |
|
|
|
static uint8_t bluetooth_tx_buffer[ble_uart_tx_size] = {0}; |
|
|
|
static uint8_t bluetooth_rx_buffer[ble_uart_rx_size] = {0}; |
|
|
|
|
|
|
@ -63,9 +66,8 @@ void processrxjson(cJSON *rxjson) { |
|
|
|
|
|
|
|
if (strcmp(order, "setPosition") == 0) { |
|
|
|
process_setPosition(rxjson); |
|
|
|
|
|
|
|
} else if (strcmp(order, "getStatus") == 0) { |
|
|
|
|
|
|
|
} else if (strcmp(order, "getStatus") == 0) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -90,10 +92,22 @@ void motor_on_event(motor_event_t event) { |
|
|
|
//上报 |
|
|
|
//{ "order": "deviceStatusReport", "ble_uart_index": 0, "deviceState": "running", "position":13.9, "deviceException": 0, "deviceExceptionInfo": "", } |
|
|
|
sprintf((char *)buffer, "{ \"order\": \"receipt\", \"code\": 0, \"info\": \"success\", \"index\": %d }", 1); |
|
|
|
bleuart_notify_send(buffer,strlen((char *)buffer)); |
|
|
|
bleuart_notify_send(buffer, strlen((char *)buffer)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void gpio_debug_light_init() { |
|
|
|
gpio_config_t gpio_grb_led_structer; |
|
|
|
|
|
|
|
gpio_grb_led_structer.intr_type = GPIO_INTR_DISABLE; |
|
|
|
gpio_grb_led_structer.mode = GPIO_MODE_INPUT; |
|
|
|
gpio_grb_led_structer.pin_bit_mask = GPIO_KEY_INPUT_PIN_SEL; |
|
|
|
gpio_grb_led_structer.pull_down_en = 0; |
|
|
|
gpio_grb_led_structer.pull_up_en = 0; |
|
|
|
|
|
|
|
gpio_config(&gpio_grb_led_structer); |
|
|
|
} |
|
|
|
|
|
|
|
void app_main(void) { |
|
|
|
bleuart_init(&ble_uart_init_struct); |
|
|
|
bleuart_reg_cb(blerxcb); |
|
|
@ -102,7 +116,9 @@ void app_main(void) { |
|
|
|
motor_reg_event_cb(motor_on_event); |
|
|
|
|
|
|
|
while (true) { |
|
|
|
bleuart_schedule(); |
|
|
|
motor_module_schedule(); |
|
|
|
// bleuart_schedule(); |
|
|
|
// motor_module_schedule(); |
|
|
|
// ESP_LOGI("log1", "%d", gpio_get_level(27)); |
|
|
|
ESP_LOGI("log2", "%d", gpio_get_level(14)); |
|
|
|
} |
|
|
|
} |