projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Report nsat in view in APRS packet
[fw/altos]
/
src
/
drivers
/
ao_aprs.c
diff --git
a/src/drivers/ao_aprs.c
b/src/drivers/ao_aprs.c
index 25a651ca3a836ac4eb9593606a84ced0be9856a6..c327c89702e8fc8a34c772a4752830a0c39a8d9f 100644
(file)
--- a/
src/drivers/ao_aprs.c
+++ b/
src/drivers/ao_aprs.c
@@
-488,9
+488,21
@@
static void tncCompressInt(uint8_t *dest, int32_t value, int len) {
}
}
}
}
-#if HAS_ADC
+static int ao_num_sats(void)
+{
+ int i;
+ int n = 0;
+
+ for (i = 0; i < ao_gps_tracking_data.channels; i++) {
+ if (ao_gps_tracking_data.sats[i].svid)
+ n++;
+ }
+ return n;
+}
+
static int tncComment(uint8_t *buf)
{
static int tncComment(uint8_t *buf)
{
+#if HAS_ADC
struct ao_data packet;
ao_arch_critical(ao_data_get(&packet););
struct ao_data packet;
ao_arch_critical(ao_data_get(&packet););
@@
-500,15
+512,19
@@
static int tncComment(uint8_t *buf)
int16_t main = ao_ignite_decivolt(AO_SENSE_MAIN(&packet));
return sprintf((char *) buf,
int16_t main = ao_ignite_decivolt(AO_SENSE_MAIN(&packet));
return sprintf((char *) buf,
- "B:%d.%d A:%d.%d M:%d.%d",
+ "S: %d B:%d.%d A:%d.%d M:%d.%d",
+ ao_num_sats(),
battery/10,
battery % 10,
apogee/10,
apogee%10,
main/10,
main%10);
battery/10,
battery % 10,
apogee/10,
apogee%10,
main/10,
main%10);
-}
+#else
+ return sprintf((char *) buf,
+ "S: %d", ao_num_sats());
#endif
#endif
+}
/**
* Generate the plain text position packet.
/**
* Generate the plain text position packet.
@@
-556,11
+572,7
@@
static int tncPositionPacket(void)
*buf++ = 33 + ((1 << 5) | (2 << 3));
*buf++ = 33 + ((1 << 5) | (2 << 3));
-#if HAS_ADC
buf += tncComment(buf);
buf += tncComment(buf);
-#else
- *buf = '\0';
-#endif
return buf - tncBuffer;
}
return buf - tncBuffer;
}