Browse Source

update

master
zwsd 3 years ago
parent
commit
ce6a20fd90
  1. 20
      main/main.c

20
main/main.c

@ -48,10 +48,16 @@ void construct_set_position_packet_and_report(int index, uint8_t setPosition_cod
ESP_LOGI(MAIN_LOG_TAG, "Command setPosition execution complete!");
if (setPosition_code == 0) {
snprintf((char *)buffer, construct_cmd_packet_buffer_size, "{ \"order\": \"receipt\", \"code\": %d, \"info\": \"success\", \"index\": %d }", setPosition_code, index);
snprintf((char *)buffer, construct_cmd_packet_buffer_size, "{ \"order\": \"receipt\", \"code\": %d, \"info\": \"success\", \"index\": %d }", //
/* code :*/ setPosition_code, //
/* index :*/ index //
);
bleuart_notify_send(buffer, strlen((char *)buffer));
} else {
snprintf((char *)buffer, construct_cmd_packet_buffer_size, "{ \"order\": \"receipt\", \"code\": %d, \"info\": \"error\", \"index\": %d }", setPosition_code, index);
snprintf((char *)buffer, construct_cmd_packet_buffer_size, "{ \"order\": \"receipt\", \"code\": %d, \"info\": \"error\", \"index\": %d }", //
/* code :*/ setPosition_code, //
/* index :*/ index //
);
bleuart_notify_send(buffer, strlen((char *)buffer));
}
}
@ -62,12 +68,18 @@ void construct_get_status_packet_and_report(int index, double motor_position) {
snprintf((char *)buffer, construct_cmd_packet_buffer_size,
"{ \"order\": \"receipt\", \"index\": %d, \"deviceState\": \"%s\", \"deviceException\": 0, \"deviceExceptionInfo\": "
", \"position\":%lf }",
index, "idel", motor_position);
/* index :*/ index, //
/* deviceState :*/ "idel", //
/* positon :*/ motor_position //
);
} else {
snprintf((char *)buffer, construct_cmd_packet_buffer_size,
"{ \"order\": \"receipt\", \"index\": %d, \"deviceState\": \"%s\", \"deviceException\": 0, \"deviceExceptionInfo\": "
", \"position\":%lf }",
index, "rotating", motor_position);
/* index :*/ index, //
/* deviceState :*/ "rotating", //
/* positon :*/ motor_position //
);
}
ESP_LOGI(MAIN_LOG_TAG, "report %s", buffer);

Loading…
Cancel
Save