Command to get decoded servo value

This commit is contained in:
Benjamin Vedder 2014-09-20 15:23:36 +02:00
parent 10bbe73206
commit e27df0235f
2 changed files with 10 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include "mcpwm.h"
#include "app.h"
#include "timeout.h"
#include "servo_dec.h"
#include <math.h>
#include <string.h>
@ -318,6 +319,13 @@ void commands_process_packet(unsigned char *data, unsigned char len) {
// Do nothing, just reset the timeout so the motor keeps running.
break;
case COMM_GET_DECODED_PPM:
ind = 0;
send_buffer[ind++] = COMM_GET_DECODED_PPM;
buffer_append_int32(send_buffer, (int32_t)(servodec_get_servo(0) * 1000000.0), &ind);
send_packet(send_buffer, ind);
break;
default:
break;
}

View File

@ -175,7 +175,8 @@ typedef enum {
COMM_EXPERIMENT_SAMPLE,
COMM_DETECT_MOTOR_PARAM,
COMM_REBOOT,
COMM_ALIVE
COMM_ALIVE,
COMM_GET_DECODED_PPM
} COMM_PACKET_ID;
#endif /* DATATYPES_H_ */