[tuxdroid-svn] r743 - daemon/trunk/libs
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-11-29 10:50:22
|
Author: jaguarondi Date: 2007-11-29 11:50:21 +0100 (Thu, 29 Nov 2007) New Revision: 743 Modified: daemon/trunk/libs/USBDaemon_status_table.c Log: * BUG: all buttons status and some others were assigned the old status value instead of the new status received. This has been lying around from the beginning though most values were simple flags so it wasn't really noticeable. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-28 19:01:47 UTC (rev 742) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-29 10:50:21 UTC (rev 743) @@ -79,7 +79,8 @@ tux_status.sound_flash.flash_usage = data[2]; log_debug("%d sounds in flash", tux_status.sound_flash.number_of_sounds); - log_debug("the last block used is : %d ", tux_status.sound_flash.flash_usage); + log_debug("the last block used is : %d ", + tux_status.sound_flash.flash_usage); } /** @@ -92,8 +93,8 @@ /* Priority to unplugged. */ if (!tux_status.io.plugged) *state = CHARGER_UNPLUGGED; - /* Plugged, is is charging? */ - else if (!tux_status.io.charger_led_signal) + /* Plugged, is it charging? */ + else if (tux_status.io.charger_led_signal) *state = CHARGER_CHARGING; /* TODO add *state = CHARGER_PLUGGED_NO_POWER; when it will be implemented @@ -165,24 +166,24 @@ /* Left wing button. */ if ((sensors1.Byte & 0x01) != (new_value & 0x01)) { - tux_status.buttons.left_flipper = (sensors1.Byte & 0x01) ? false : true; - log_debug("Left flipper %s", tux_status.buttons.left_flipper ? + tux_status.buttons.left_flipper = (new_value & 0x01) ? true : false; + log_debug("left flipper %s", tux_status.buttons.left_flipper ? "pushed" : "released"); tcp_frame[4] = DATA_STATUS_LEFT_WING_PUSH; - tcp_frame[5] = !sensors1.bits.PB0; + tcp_frame[5] = tux_status.buttons.left_flipper; tcp_server_send_raw(tcp_frame); } /* Right wing button. */ if ((sensors1.Byte & 0x02) != (new_value & 0x02)) { - tux_status.buttons.right_flipper = (sensors1.Byte & 0x02) ? false : true; - log_debug("Right flipper %s", tux_status.buttons.right_flipper ? + tux_status.buttons.right_flipper = (new_value & 0x02) ? true : false; + log_debug("right flipper %s", tux_status.buttons.right_flipper ? "pushed" : "released"); tcp_frame[4] = DATA_STATUS_RIGHT_WING_PUSH; - tcp_frame[5] = !sensors1.bits.PB1; + tcp_frame[5] = tux_status.buttons.right_flipper; tcp_server_send_raw(tcp_frame); } @@ -192,14 +193,14 @@ * pull-up and capacitor slow down the switch detection). */ if ((sensors1.Byte & 0x14) != (new_value & 0x14)) { - tux_status.io.plugged = (sensors1.Byte & 0x04) ? true : false; + tux_status.io.plugged = (new_value & 0x04) ? true : false; log_debug("io: power cable %s", tux_status.io.plugged ? "plugged" : "unplugged"); tux_status.io.charger_led_signal = - (sensors1.Byte & 0x10) ? true : false; + (new_value & 0x10) ? true : false; log_debug("io: charger LED %s", tux_status.io.charger_led_signal ? - "high" : "low"); + "ON (low)" : "OFF (high)"); update_charger_state(); tcp_frame[4] = DATA_STATUS_CHARGER_STATUS; @@ -210,12 +211,12 @@ /* Head button. */ if ((sensors1.Byte & 0x08) != (new_value & 0x08)) { - tux_status.buttons.head = (sensors1.Byte & 0x08) ? false : true; - log_debug("Head button %s", tux_status.buttons.head ? + tux_status.buttons.head = (new_value & 0x08) ? true : false; + log_debug("head button %s", tux_status.buttons.head ? "pressed" : "released"); tcp_frame[4] = DATA_STATUS_HEAD_PUSH_SWITCH; - tcp_frame[5] = !sensors1.bits.PB3; + tcp_frame[5] = tux_status.buttons.head; tcp_server_send_raw(tcp_frame); } @@ -223,7 +224,7 @@ if ((sensors1.Byte & 0x80) != (new_value & 0x80)) { tcp_frame[4] = DATA_STATUS_MUTE_STATUS; - tcp_frame[5] = !sensors1.bits.PB7; + tcp_frame[5] = !!(new_value & 0x80); log_debug("mute status %s", tcp_frame[5] ? "on" : "off"); tcp_server_send_raw(tcp_frame); } |