X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao_cmd.c;h=6e91a72d5b452c31e75a01140afd9a4af20fd4a4;hp=3b69541b8e6ef006e1e3cf742d35e0b633a3aaa7;hb=5be13b76a2e29b84cd6d1eec065e3354b0dafce5;hpb=022f83ca6fd589005d8eb3e25e633950fef69fa7 diff --git a/ao_cmd.c b/ao_cmd.c index 3b69541b..6e91a72d 100644 --- a/ao_cmd.c +++ b/ao_cmd.c @@ -3,8 +3,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -253,6 +252,34 @@ adc_dump(void) put_string("\n"); } +static void +gps_dump(void) __reentrant +{ + ao_mutex_get(&ao_gps_mutex); + if (ao_gps_data.flags & AO_GPS_VALID) { + printf("GPS %2d:%02d:%02d %2d°%2d.%04d'%c %2d°%2d.%04d'%c %5dm %2d sat\n", + ao_gps_data.hour, + ao_gps_data.minute, + ao_gps_data.second, + ao_gps_data.latitude.degrees, + ao_gps_data.latitude.minutes, + ao_gps_data.latitude.minutes_fraction, + (ao_gps_data.flags & AO_GPS_LATITUDE_MASK) == AO_GPS_LATITUDE_NORTH ? + 'N' : 'S', + ao_gps_data.longitude.degrees, + ao_gps_data.longitude.minutes, + ao_gps_data.longitude.minutes_fraction, + (ao_gps_data.flags & AO_GPS_LONGITUDE_MASK) == AO_GPS_LONGITUDE_WEST ? + 'W' : 'E', + ao_gps_data.altitude, + (ao_gps_data.flags & AO_GPS_NUM_SAT_MASK) >> AO_GPS_NUM_SAT_SHIFT); + } else { + printf("GPS %2d sat\n", + (ao_gps_data.flags & AO_GPS_NUM_SAT_MASK) >> AO_GPS_NUM_SAT_SHIFT);; + } + ao_mutex_put(&ao_gps_mutex); +} + static void dump(void) { @@ -489,12 +516,14 @@ static const uint8_t help_txt[] = "All numbers are in hex\n" "? Print this message\n" "a Display current ADC values\n" + "g Display current GPS values\n" "d Dump memory\n" "e Dump a block of EEPROM data\n" "w ... Write data to EEPROM\n" "l Dump last flight log\n" "E <0 off, 1 on> Set command echo mode\n" "S Send data to serial line\n" + "T Show task states\n" "\n" "Target debug commands:\n" "D Enable debug mode\n" @@ -546,6 +575,9 @@ ao_cmd(void *parameters) case 'a': adc_dump(); break; + case 'g': + gps_dump(); + break; case 'e': ee_dump(); break; @@ -555,6 +587,9 @@ ao_cmd(void *parameters) case 'l': dump_log(); break; + case 'T': + ao_task_info(); + break; case 'S': send_serial(); break; @@ -596,5 +631,5 @@ __xdata struct ao_task ao_cmd_task; void ao_cmd_init(void) { - ao_add_task(&ao_cmd_task, ao_cmd); + ao_add_task(&ao_cmd_task, ao_cmd, "cmd"); }