summaryrefslogtreecommitdiff
path: root/monitor_tnt.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-12 06:43:40 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-12 06:43:40 -0400
commit219be4d46842d4261c51772f1391d11a9c5611a9 (patch)
tree4d6e117abd3dfd14a79e64e029ad9560abfa1521 /monitor_tnt.c
parentd60297a3788a2d7da3d872f30dc2eca752537a8d (diff)
downloadgpsd-219be4d46842d4261c51772f1391d11a9c5611a9.tar.gz
Live monitor_tnt.c, but in a way that breaks gpsd, sigh.
The problem is in nmea_parse_input(). Currently we can have recognition of a sentence as a trigger sreing, or we can have NMEA parsing of it, but we can't have both.
Diffstat (limited to 'monitor_tnt.c')
-rw-r--r--monitor_tnt.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/monitor_tnt.c b/monitor_tnt.c
index 91ae3e7f..7b1aa505 100644
--- a/monitor_tnt.c
+++ b/monitor_tnt.c
@@ -36,24 +36,20 @@ static WINDOW *thtmwin;
static bool tnt_initialize(void)
{
/*@ -onlytrans @*/
- thtmwin = derwin(devicewin, 3, 40, 0, 0);
+ thtmwin = derwin(devicewin, 6, 80, 0, 0);
(void)wborder(thtmwin, 0, 0, 0, 0, 0, 0, 0, 0),
(void)syncok(thtmwin, true);
(void)wattrset(thtmwin, A_BOLD);
- (void)mvwprintw(thtmwin, 1, 1, "Heading: ");
- (void)mvwprintw(thtmwin, 2, 1, "Pitch: ");
- (void)mvwprintw(thtmwin, 3, 1, "Roll: ");
- (void)mvwprintw(thtmwin, 4, 1, "Dip: ");
- (void)mvwprintw(thtmwin, 5, 1, "Mag Field Len: ");
- (void)mvwprintw(thtmwin, 6, 1, "Mag Field X: ");
- (void)mvwprintw(thtmwin, 7, 1, "Mag Field Y: ");
- (void)mvwprintw(thtmwin, 8, 1, "Mag Field Z: ");
- (void)mvwprintw(thtmwin, 9, 1, "Acceleration Len: ");
- (void)mvwprintw(thtmwin, 10, 1, "Acceleration X: ");
- (void)mvwprintw(thtmwin, 11, 1, "Acceleration Y: ");
- (void)mvwprintw(thtmwin, 12, 1, "Acceleration Z: ");
- (void)mvwprintw(thtmwin, 13, 1, "Depth: ");
- (void)mvwprintw(thtmwin, 14, 1, "Temperature: ");
+ (void)mvwaddstr(thtmwin, 0, 35, " PTNTHTM ");
+ (void)mvwaddstr(thtmwin, 1, 1, "Heading: ");
+ (void)mvwaddstr(thtmwin, 2, 1, "Pitch: ");
+ (void)mvwaddstr(thtmwin, 3, 1, "Roll: ");
+ (void)mvwaddstr(thtmwin, 4, 1, "Dip: ");
+
+ (void)mvwaddstr(thtmwin, 1, 40, "Magnetometer Status: ");
+ (void)mvwaddstr(thtmwin, 2, 40, "Pitch Status: ");
+ (void)mvwaddstr(thtmwin, 3, 40, "Roll Status ");
+ (void)mvwaddstr(thtmwin, 4, 40, "Horizontal Field: ");
(void)wattrset(thtmwin, A_NORMAL);
/*@ +onlytrans @*/
return true;
@@ -61,17 +57,21 @@ static bool tnt_initialize(void)
static void tnt_update(void)
{
- /*
- * Called on each packet received. The packet will be accessible in
- * session.packet.outbuffer and the length in session.packet.outbuflen.
- * If the device is NMEA, session.driver.nmea.fields[] will contain the
- * array of unconverted field strings, including the tag in slot zero
- * but not including the checksum or trailing \r\n.
- *
- * Use this function to update devicewin. The packet will be echoed to
- * packetwin immediately after this function is called; you can use this
- * function to write a prefix on the line.
+ /*
+ * We have to do our own field parsing because the way this
+ * gets valled, nmea_parse() is never called on the sentence.
*/
+ (void)nmea_parse((char *)session.packet.outbuffer, &session);
+
+ (void)mvwaddstr(thtmwin, 1, 19, session.driver.nmea.field[1]);
+ (void)mvwaddstr(thtmwin, 2, 19, session.driver.nmea.field[3]);
+ (void)mvwaddstr(thtmwin, 3, 19, session.driver.nmea.field[5]);
+ (void)mvwaddstr(thtmwin, 4, 19, session.driver.nmea.field[7]);
+
+ (void)mvwaddstr(thtmwin, 1, 61, session.driver.nmea.field[2]);
+ (void)mvwaddstr(thtmwin, 2, 61, session.driver.nmea.field[4]);
+ (void)mvwaddstr(thtmwin, 3, 61, session.driver.nmea.field[6]);
+ (void)mvwaddstr(thtmwin, 4, 61, session.driver.nmea.field[8]);
}
static int tnt_command(char line[])
@@ -116,7 +116,7 @@ const struct monitor_object_t tnt_mmt = {
.update = tnt_update,
.command = tnt_command,
.wrap = tnt_wrap,
- .min_y = 16, .min_x = 80, /* size of the device window */
+ .min_y = 6, .min_x = 80, /* size of the device window */
.driver = &trueNorth,
};
#endif /* TNT_ENABLE */