*
* 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
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)
{
lex_echo = lex_i != 0;
}
-#if INCLUDE_REMOTE_DEBUG
static void
debug_enable(void)
{
- dbg_debug_mode();
+ ao_dbg_debug_mode();
}
static void
debug_reset(void)
{
- dbg_reset();
+ ao_dbg_reset();
}
static void
hex();
if (lex_status != SUCCESS)
break;
- dbg_send_byte(lex_i);
+ ao_dbg_send_byte(lex_i);
}
}
for (i = 0; i < count; i++) {
if (i && (i & 7) == 0)
put_string("\n");
- byte = dbg_recv_byte();
+ byte = ao_dbg_recv_byte();
put8(byte);
putchar(' ');
}
addr = lex_i;
if (lex_status != SUCCESS)
return;
- dbg_start_transfer(addr);
+ ao_dbg_start_transfer(addr);
i = 0;
while (count--) {
if (!(i++ & 7))
put_string("\n");
- b = dbg_read_byte();
+ b = ao_dbg_read_byte();
put8(b);
}
- dbg_end_transfer();
+ ao_dbg_end_transfer();
put_string("\n");
}
addr = lex_i;
if (lex_status != SUCCESS)
return;
- dbg_start_transfer(addr);
+ ao_dbg_start_transfer(addr);
while (count--) {
b = getnibble() << 4;
b |= getnibble();
if (lex_status != SUCCESS)
return;
- dbg_write_byte(b);
+ ao_dbg_write_byte(b);
}
- dbg_end_transfer();
+ ao_dbg_end_transfer();
}
-#endif
static void
dump_log(void)
}
}
+static void
+send_serial(void)
+{
+ white();
+ while (lex_c != '\n') {
+ ao_serial_putchar(lex_c);
+ lex();
+ }
+}
+
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 <start> <end> Dump memory\n"
"e <block> Dump a block of EEPROM data\n"
"w <block> <start> <len> <data> ... Write data to EEPROM\n"
"l Dump last flight log\n"
"E <0 off, 1 on> Set command echo mode\n"
-#if INCLUDE_REMOTE_DEBUG
+ "S<data> Send data to serial line\n"
+ "T Show task states\n"
"\n"
"Target debug commands:\n"
"D Enable debug mode\n"
"G <count> Get data from debug port\n"
"O <count> <addr> Output <count> bytes to target at <addr>\n"
"I <count> <addr> Input <count> bytes to target at <addr>\n"
-#endif
;
static void
case 'a':
adc_dump();
break;
+ case 'g':
+ gps_dump();
+ break;
case 'e':
ee_dump();
break;
case 'l':
dump_log();
break;
+ case 'T':
+ ao_task_info();
+ break;
+ case 'S':
+ send_serial();
+ break;
case 'E':
echo();
break;
-#if INCLUDE_REMOTE_DEBUG
case 'D':
debug_enable();
break;
case 'O':
debug_output();
break;
-#endif
case '\r':
case '\n':
break;
void
ao_cmd_init(void)
{
- ao_add_task(&ao_cmd_task, ao_cmd);
+ ao_add_task(&ao_cmd_task, ao_cmd, "cmd");
}