10 #include <robottype.h>
15 int oled_send_hw_status(uint8_t *buff, int buff_size, uint8_t *status)
17 if(buff_size < HW_STATUS_MSG_SIZE)
20 buff[0] = HW_STATUS_MSG;
30 return HW_STATUS_MSG_SIZE;
33 int oled_set_color(uint8_t *buff, int buff_size, uint8_t color)
35 if(buff_size < COLOR_MSG_SIZE)
41 return COLOR_MSG_SIZE;
44 int oled_send_game_conf(uint8_t *buff, int buff_size, uint8_t conf)
46 if(buff_size < CONF_MSG_SIZE)
49 buff[0] = GAME_CONF_MSG;
50 sprintf((char*)buff+1, "%1d", conf);
51 sprintf((char*)buff+2, "%1d", conf);
56 int oled_switch_mode(uint8_t *buff, int buff_size, uint8_t mode, uint8_t status)
58 if(buff_size < SWITCH_MODE_MSG_SIZE)
61 *(buff+0) = CHANGE_MODE_REP;
66 return SWITCH_MODE_MSG_SIZE;
69 int oled_send_voltage(uint8_t *buff, int buff_size, struct pwr_voltage_type *volt)
72 if(buff_size < VOLTAGE_MSG_SIZE)
75 buff[0] = VOLTAGE_MSG;
77 sprintf((char*)(buff+1),"%1.2f",volt->voltage33);
79 sprintf((char*)(buff+5),"%1.2f",volt->voltage50);
81 sprintf((char*)(buff+9),"%1.2f",volt->voltage80);
83 sprintf((char*)(buff+13),"%2.2f",volt->voltageBAT);
85 *(buff+18) = MSG_TERM;
87 return VOLTAGE_MSG_SIZE;
90 int oled_send_position(uint8_t *buff, int buff_size, struct est_pos_type *pos)
92 if(buff_size < POSITION_MSG_SIZE)
95 buff[0] = POSITION_MSG;
97 sprintf((char*)(buff+1),"%1.2f",pos->x);
99 sprintf((char*)(buff+5),"%1.2f",pos->y);
101 sprintf((char*)(buff+9),"%1.2f",pos->phi);
103 *(buff+13) = MSG_TERM;
105 return POSITION_MSG_SIZE;
108 int oled_send_fsm_state(uint8_t *buff, int buff_size, const char *name, int len, uint8_t type)
110 memset(buff, ' ', FSM_STATE_MSG_SIZE);
112 strncpy((char*)buff+1, name, (len > 20) ? 20 : len);
113 buff[FSM_STATE_MSG_SIZE-1] = MSG_TERM;
115 return FSM_STATE_MSG_SIZE;
118 int oled_send_pucks_nr(uint8_t *buff, int buff_size, char nr)
120 if(buff_size < PUCKS_MSG_SIZE)
124 sprintf((char*)buff+1, "%1d", nr);
127 return PUCKS_MSG_SIZE;
130 int oled_send_lift_pos(uint8_t *buff, int buff_size, uint16_t pos)
132 if(buff_size < LIFT_MSG_SIZE)
136 sprintf((char*)buff+1, "%4d", pos);
139 return LIFT_MSG_SIZE;