static void
ao_adxl375_dump(void)
{
- printf ("ADXL375 value %d %d %d self test %d min %d max %d\n",
+ printf ("ADXL375 value %d %d %d self test %ld min %ld max %ld\n",
ao_adxl375_current.x,
ao_adxl375_current.y,
ao_adxl375_current.z,
- self_test_value,
- MIN_SELF_TEST,
- MAX_SELF_TEST);
+ (long) self_test_value,
+ (long) MIN_SELF_TEST,
+ (long) MAX_SELF_TEST);
}
const struct ao_cmds ao_adxl375_cmds[] = {
#define TNC_TX_DELAY 45
/// The size of the TNC output buffer.
-#define TNC_BUFFER_SIZE 40
+#define TNC_BUFFER_SIZE 48
/// States that define the current mode of the 1200 bps (A-FSK) state machine.
typedef enum
ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
for (;;) {
- PRINTD("Drag monitor count %d active %d delay %d\n",
- ao_lco_drag_beep_count, ao_lco_drag_active, delay);
+ PRINTD("Drag monitor count %d active %d delay %lu\n",
+ ao_lco_drag_beep_count, ao_lco_drag_active, (unsigned long) delay);
if (delay == (AO_TICK_TYPE) ~0)
ao_sleep(&ao_lco_drag_beep_count);
else
for (;;) {
ao_event_get(&event);
- PRINTD("event type %d unit %d value %d\n",
- event.type, event.unit, event.value);
+ PRINTD("event type %d unit %d value %ld\n",
+ event.type, event.unit, (long) event.value);
switch (event.type) {
case AO_EVENT_QUADRATURE:
switch (event.unit) {
#if DEBUG
extern uint8_t ao_lco_debug;
-#define PRINTD(...) do { if (!ao_lco_debug) break; printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0)
+#define PRINTD(...) do { if (!ao_lco_debug) break; printf ("\r%5lu %s: ", (unsigned long) ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0)
#else
#define PRINTD(...)
#endif
AO_TICK_TYPE
ao_lco_drag_beep_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
{
- PRINTD("beep check count %d delta %d\n",
+ PRINTD("beep check count %d delta %ld\n",
ao_lco_drag_beep_count,
- (AO_TICK_SIGNED) (now - ao_lco_drag_beep_time));
+ (long) (AO_TICK_SIGNED) (now - ao_lco_drag_beep_time));
if (ao_lco_drag_beep_count) {
if ((AO_TICK_SIGNED) (now - ao_lco_drag_beep_time) >= 0) {
if (ao_lco_drag_beep_on) {
ao_event_get(&event);
}
ao_lco_wakeup();
- PRINTD("event type %d unit %d value %d\n",
- event.type, event.unit, event.value);
+ PRINTD("event type %d unit %d value %ld\n",
+ event.type, event.unit, (long) event.value);
switch (event.type) {
case AO_EVENT_BUTTON:
switch (event.unit) {
#define DEBUG_LOW 1
#define DEBUG_HIGH 2
#if 1
-#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0)
+#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5lu %s: ", (unsigned long) ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0)
#else
#define PRINTD(l,...)
#endif
break;
}
if ((AO_TICK_SIGNED) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
- PRINTD ("late pad arm_time %d time %d\n",
- ao_pad_arm_time, ao_time());
+ PRINTD ("late pad arm_time %ld time %ld\n",
+ (long) ao_pad_arm_time, ao_time());
break;
}
PRINTD ("ignite\n");
if (!ao_log_running) ao_log_start();
#endif
if ((AO_TICK_SIGNED) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
- PRINTD ("late pad arm_time %d time %d\n",
- ao_pad_arm_time, ao_time());
+ PRINTD ("late pad arm_time %ld time %ld\n",
+ (long) ao_pad_arm_time, (long) ao_time());
break;
}
PRINTD ("ignite\n");
t = ao_quadrature_step[q];
printf("step %3d ", t);
#endif
- printf ("count %3d state %2x\n", c, s);
+ printf ("count %3ld state %2x\n", (long) c, s);
flush();
}
}
ao_config_log_set(void)
{
#if FLIGHT_LOG_APPEND
- printf("Flight log fixed size %d kB\n", ao_storage_log_max >> 10);
+ printf("Flight log fixed size %u kB\n", (unsigned) (ao_storage_log_max >> 10));
#else
uint32_t r;
return;
}
if (r > ao_storage_log_max) {
- printf("Flight log max %d kB\n", ao_storage_log_max >> 10);
+ printf("Flight log max %u kB\n", (unsigned) (ao_storage_log_max >> 10));
return;
}
_ao_config_edit_start();
#include <ao_data.h>
#include <ao_flight.h>
-static struct ao_log_telestatic log;
+static struct ao_log_telestatic log_data;
const uint8_t ao_log_format = AO_LOG_FORMAT_TELESTATIC;
{
uint8_t wrote = 0;
/* set checksum */
- log.csum = 0;
- log.csum = ao_log_csum((uint8_t *) &log);
+ log_data.csum = 0;
+ log_data.csum = ao_log_csum((uint8_t *) &log_data);
ao_mutex_get(&ao_log_mutex); {
if (ao_log_current_pos >= ao_log_end_pos && ao_log_running)
ao_log_stop();
if (ao_log_running) {
wrote = 1;
ao_storage_write(ao_log_current_pos,
- &log,
+ &log_data,
sizeof (struct ao_log_telestatic));
ao_log_current_pos += sizeof (struct ao_log_telestatic);
}
while (!ao_log_running)
ao_sleep(&ao_log_running);
- log.type = AO_LOG_FLIGHT;
- log.tick = ao_time();
- log.u.flight.flight = ao_flight_number;
+ log_data.type = AO_LOG_FLIGHT;
+ log_data.tick = ao_time();
+ log_data.u.flight.flight = ao_flight_number;
ao_log_telestatic();
/* Write the whole contents of the ring to the log
for (;;) {
/* Write samples to EEPROM */
while (ao_log_data_pos != ao_data_head) {
- log.tick = ao_data_ring[ao_log_data_pos].tick;
- log.type = AO_LOG_SENSOR;
+ log_data.tick = ao_data_ring[ao_log_data_pos].tick;
+ log_data.type = AO_LOG_SENSOR;
#if HAS_ADS131A0X
- log.u.sensor.pressure = ao_data_ring[ao_log_data_pos].ads131a0x.ain[0];
- log.u.sensor.pressure2 = ao_data_ring[ao_log_data_pos].ads131a0x.ain[1];
- log.u.sensor.thrust = ao_data_ring[ao_log_data_pos].ads131a0x.ain[2];
- log.u.sensor.mass = ao_data_ring[ao_log_data_pos].ads131a0x.ain[3];
+ log_data.u.sensor.pressure = ao_data_ring[ao_log_data_pos].ads131a0x.ain[0];
+ log_data.u.sensor.pressure2 = ao_data_ring[ao_log_data_pos].ads131a0x.ain[1];
+ log_data.u.sensor.thrust = ao_data_ring[ao_log_data_pos].ads131a0x.ain[2];
+ log_data.u.sensor.mass = ao_data_ring[ao_log_data_pos].ads131a0x.ain[3];
#endif
- log.u.sensor.t_low = ao_data_ring[ao_log_data_pos].max6691.sensor[0].t_low;
+ log_data.u.sensor.t_low = ao_data_ring[ao_log_data_pos].max6691.sensor[0].t_low;
int i;
for (i = 0; i < 4; i++)
- log.u.sensor.t_high[i] = ao_data_ring[ao_log_data_pos].max6691.sensor[i].t_high;
+ log_data.u.sensor.t_high[i] = ao_data_ring[ao_log_data_pos].max6691.sensor[i].t_high;
ao_log_telestatic();
ao_log_data_pos = ao_data_ring_next(ao_log_data_pos);
}
height = -height;
if (ao_tracker_force_telem > 1)
- printf("head %d ring %d ground_distance %d height %d\n", gps_head, ring, ground_distance, height);
+ printf("head %d ring %d ground_distance %ld height %d\n", gps_head, ring, (long) ground_distance, height);
if (ground_distance > ao_config.tracker_motion ||
height > (ao_config.tracker_motion << 1))
{
if (ao_log_present())
printf ("flight %d start %x end %x\n",
1,
- 0, MAX_LOG_OFFSET >> 8);
+ 0, (unsigned) (MAX_LOG_OFFSET >> 8));
printf ("done\n");
}
void
ao_storage_device_info(void)
{
- printf ("Using internal flash, page %d bytes, total %d bytes\n",
- ao_storage_block, ao_storage_total);
+ printf ("Using internal flash, page %ld bytes, total %ld bytes\n",
+ (long) ao_storage_block, (long) ao_storage_total);
}
void
ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200));
for (;;) {
- PRINTD("Drag monitor count %d delay %d\n", ao_lco_drag_beep_count, delay);
+ PRINTD("Drag monitor count %d delay %lu\n", ao_lco_drag_beep_count, (unsigned long) delay);
if (delay == (AO_TICK_TYPE) ~0)
ao_sleep(&ao_lco_drag_beep_count);
else
for (;;) {
ao_event_get(&event);
- PRINTD("event type %d unit %d value %d\n",
- event.type, event.unit, event.value);
+ PRINTD("event type %d unit %d value %ld\n",
+ event.type, event.unit, (long) event.value);
switch (event.type) {
case AO_EVENT_QUADRATURE:
switch (event.unit) {
{ 0, NULL },
};
-void
+int
main(void)
{
ao_clock_init();