UDE_hw_status_t status = STATUS_FAILED;
static UDE_hw_status_t last_status;
static struct timespec last_sent;
- //struct camera_result_type *instance = (struct camera_result_type *)vinstance;
+ struct camera_result_type *instance = (struct camera_result_type *)vinstance;
+ char s, c;
switch (info->status) {
case NEW_DATA:
- status = STATUS_OK;
+ if (instance->error == 0)
+ status = STATUS_OK;
+ else
+ status = STATUS_WARNING;
break;
case DEADLINE:
status = STATUS_FAILED;
clock_gettime(CLOCK_MONOTONIC, &last_sent);
}
last_status = status;
+
+ if (status == STATUS_OK) {
+ s = (instance->side >= 0 && instance->side < 10) ?
+ '0'+instance->side : 'E';
+ c = (instance->center >= 0 && instance->center < 10) ?
+ '0'+instance->center : 'E';
+ } else
+ s = c = '-';
+ uoled_display_corns(s, c);
}
void rcv_hokuyo_scan_cb(const ORTERecvInfo *info, void *vinstance,
}
-
+struct robottype_orte_data orte;
int main(int argc, char *argv[])
{
int ret;
//int size;
- struct robottype_orte_data orte;
char * tty;
signal(SIGINT, sig_handler);
}
sercom = uoled_sercom_init(tty, NULL);
- if (strcmp(tty, "/dev/null") != 0 && sercom) {
+ if (strcmp(tty, "/dev/null") == 0 || sercom != NULL) {
// :wq
printf("displayd: init serial communication OK\n");
} else {
fprintf(stderr, "displayd: init serial communication failed\n");
-#ifdef COMPETITION
+//#ifdef COMPETITION
/* Sleep in order to that not be respawn too fast by init */
sleep(3);
return 1;
-#endif
+//#endif
}
- orte.strength = 1;
-
/* orte initialization */
if(robottype_roboorte_init(&orte)) {
fprintf(stderr, "displayd: Roboorte initialization failed! Exiting...\n");
if (strcmp(tty, "/dev/null") != 0) {
ret = poll(pfd, 1, 500/*ms*/);
if (ret > 0) {
- rcmd = uoled_recieve_cmd();
- orte.display_cmd.command=rcmd;
- if (! rcmd){
- ORTEPublicationSend(orte.publication_display_cmd);
- printf("displayd: publishing command recieved from display [ 0x%2x ]\n", rcmd);
+ ret = uoled_recieve_cmd(&rcmd);
+/* orte.display_cmd.command=rcmd; */
+/* if (! rcmd){ */
+/* ORTEPublicationSend(orte.publication_display_cmd); */
+/* printf("displayd: publishing command recieved from display [ 0x%2x ]\n", rcmd); */
- }
+/* } */
+ }
+ if (ret < 0) {
+ perror("Error: read from display");
+ break;
}
} else {
usleep(500/*ms*/*1000);
printf("displayd: destroying orte instance...\n");
robottype_roboorte_destroy(&orte);
+ if (!interrupt) {
+ printf("Waiting 3 seconds\n");
+ sleep(3);
+ }
+
printf("displayd: finished!\n");
return 0;
}