last_status = status;
}
+void rcv_robot_swicthes_cb(const ORTERecvInfo *info, void *vinstance,
+ void *recvCallBackParam)
+{
+ UDE_hw_status_t status = STATUS_FAILED;
+ static char last_color;
+ static struct timespec last_sent;
+ struct robot_switches_type *instance = (struct robot_switches_type *)vinstance;
+
+ switch (info->status) {
+ case NEW_DATA:
+ if (instance->team_color != last_color ||
+ miliseconds_elapsed_since(&last_sent, 1000)) {
+ uoled_display_color(instance->team_color);
+ clock_gettime(CLOCK_MONOTONIC, &last_sent);
+ }
+ last_color = instance->team_color;
+ case DEADLINE:
+ status = STATUS_FAILED;
+ break;
+ }
+}
+
void rcv_motion_status_cb(const ORTERecvInfo *info, void *vinstance,
void *recvCallBackParam)
{
robottype_subscriber_fsm_act_create(&orte, rcv_fsm_act_cb, &orte);
robottype_subscriber_fsm_motion_create(&orte, rcv_fsm_motion_cb, &orte);
robottype_subscriber_robot_cmd_create(&orte, rcv_robot_cmd_cb, &orte);
+ robottype_subscriber_robot_switches_create(&orte, rcv_robot_swicthes_cb, &orte);
printf("displayd: subscribers created OK\n");
return 0;
}
+int uoled_display_color(int color)
+{
+ int ret;
+ uint8_t msg[MGS_LENGTH_DISPLAY_COLOR];
+ msg[0]=ID_DISPLAY_COLOR;
+ msg[1]=(char)color;
+
+ ret = uoled_write_cmd(msg, MGS_LENGTH_DISPLAY_COLOR);
+ if(ret)
+ return -1;
+
+ return 0;
+}
+
int uoled_display_voltage(double voltage33, double voltage50,
double voltage80, double voltageBAT)
{
//#define ID_DISPLAY_SM_ACT 0x85
#define ID_DISPLAY_POSITION 0x86
#define ID_DISPLAY_ALIVE 0x87
+#define ID_DISPLAY_CORNS 0x88
+#define ID_DISPLAY_COLOR 0x89
#define MGS_LENGTH_DISPLAY_STATUS 2
#define MGS_LENGTH_DISPLAY_SM 21
#define MGS_LENGTH_DISPLAY_VOLTAGE 18
#define MGS_LENGTH_DISPLAY_POSITION 10
#define MGS_LENGTH_DISPLAY_ALIVE 1
+#define MGS_LENGTH_DISPLAY_CORNS 3
+#define MGS_LENGTH_DISPLAY_COLOR 2
#define TRESHOLDS_VOLTAGE33 3.2
#define TRESHOLDS_VOLTAGE50 4.9
*/
int uoled_display_position(double x, double y, double phi);
+int uoled_display_color(int color);
+
+
#ifdef __cplusplus
}
#endif