summaryrefslogtreecommitdiff
path: root/src/product
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2013-12-19 01:38:40 -0700
committerBdale Garbee <bdale@gag.com>2013-12-19 01:38:40 -0700
commit575bbaf976c5840fd0e308549c45a466fdec1352 (patch)
tree11bfb498348bf7687bffc24699c4b1a998988ee4 /src/product
parentb825116df173b77e2cab217a7b76112c742f9279 (diff)
parentbc3610d8cecbfed40c62d4dcb93fc9a4d2a7c9e3 (diff)
Merge branch 'branch-1.3' into debian
Conflicts: ChangeLog altoslib/AltosRecordMM.java altosui/Makefile.am altosui/altos-windows.nsi.in configure.ac debian/changelog debian/control doc/Makefile doc/altusmetrum.xsl doc/release-notes-1.2.1.xsl doc/release-notes-1.2.xsl
Diffstat (limited to 'src/product')
-rw-r--r--src/product/Makefile.teledongle4
-rw-r--r--src/product/Makefile.telelaunch4
-rw-r--r--src/product/Makefile.telemetrum6
-rw-r--r--src/product/Makefile.telemini6
-rw-r--r--src/product/Makefile.telenano4
-rw-r--r--src/product/ao_flash_pins.h3
-rw-r--r--src/product/ao_flash_task.c13
-rw-r--r--src/product/ao_micropeak.c89
-rw-r--r--src/product/ao_micropeak.h78
-rw-r--r--src/product/ao_terraui.c2
10 files changed, 187 insertions, 22 deletions
diff --git a/src/product/Makefile.teledongle b/src/product/Makefile.teledongle
index 3101b777..da9bcba0 100644
--- a/src/product/Makefile.teledongle
+++ b/src/product/Makefile.teledongle
@@ -80,9 +80,9 @@ endif
# Otherwise, print the full command line.
quiet ?= $($1)
-all: ../$(PROG)
+all: $(PROG)
-../$(PROG): $(REL) Makefile
+$(PROG): $(REL) Makefile
$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
$(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@
diff --git a/src/product/Makefile.telelaunch b/src/product/Makefile.telelaunch
index 1e55989c..a5e2eb7f 100644
--- a/src/product/Makefile.telelaunch
+++ b/src/product/Makefile.telelaunch
@@ -82,9 +82,9 @@ endif
# Otherwise, print the full command line.
quiet ?= $($1)
-all: ../$(PROG)
+all: $(PROG)
-../$(PROG): $(REL) Makefile
+$(PROG): $(REL) Makefile
$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
$(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@
diff --git a/src/product/Makefile.telemetrum b/src/product/Makefile.telemetrum
index 5e3eed7f..c740a483 100644
--- a/src/product/Makefile.telemetrum
+++ b/src/product/Makefile.telemetrum
@@ -94,10 +94,10 @@ endif
# Otherwise, print the full command line.
quiet ?= $($1)
-all: ../$(PROG)
+all: $(PROG)
-../$(PROG): $(REL) Makefile
- $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
+$(PROG): $(REL) Makefile
+ $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL)
$(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@
ao_product.h: ao-make-product.5c ../Version
diff --git a/src/product/Makefile.telemini b/src/product/Makefile.telemini
index ef8906ba..0884079e 100644
--- a/src/product/Makefile.telemini
+++ b/src/product/Makefile.telemini
@@ -83,10 +83,10 @@ endif
# Otherwise, print the full command line.
quiet ?= $($1)
-all: ../$(PROG)
+all: $(PROG)
-../$(PROG): $(REL) Makefile
- $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
+$(PROG): $(REL) Makefile
+ $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL)
$(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@
ao_product.h: ao-make-product.5c ../Version
diff --git a/src/product/Makefile.telenano b/src/product/Makefile.telenano
index 67410ae0..c31989ee 100644
--- a/src/product/Makefile.telenano
+++ b/src/product/Makefile.telenano
@@ -82,9 +82,9 @@ endif
# Otherwise, print the full command line.
quiet ?= $($1)
-all: ../$(PROG)
+all: $(PROG)
-../$(PROG): $(REL) Makefile
+$(PROG): $(REL) Makefile
$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
$(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@
diff --git a/src/product/ao_flash_pins.h b/src/product/ao_flash_pins.h
index b774df6d..dd67d820 100644
--- a/src/product/ao_flash_pins.h
+++ b/src/product/ao_flash_pins.h
@@ -35,6 +35,7 @@
#define HAS_VERSION 0
#define AO_BOOT_CHAIN 1
-#define AO_BOOT_PIN 1
+
+#define IS_FLASH_LOADER 1
#endif /* _AO_FLASH_PINS_H_ */
diff --git a/src/product/ao_flash_task.c b/src/product/ao_flash_task.c
index fdc4d0aa..4cfbf75f 100644
--- a/src/product/ao_flash_task.c
+++ b/src/product/ao_flash_task.c
@@ -73,7 +73,7 @@ static void
ao_block_erase(void)
{
uint32_t addr = ao_get_hex32();
- uint32_t *p = (uint32_t *) addr;
+ void *p = (void *) addr;
ao_flash_erase_page(p);
}
@@ -82,11 +82,8 @@ static void
ao_block_write(void)
{
uint32_t addr = ao_get_hex32();
- uint32_t *p = (uint32_t *) addr;
- union {
- uint8_t data8[256];
- uint32_t data32[64];
- } u;
+ void *p = (void *) addr;
+ uint8_t data[256];
uint16_t i;
if (addr < (uint32_t) AO_BOOT_APPLICATION_BASE) {
@@ -94,8 +91,8 @@ ao_block_write(void)
return;
}
for (i = 0; i < 256; i++)
- u.data8[i] = ao_usb_getchar();
- ao_flash_page(p, u.data32);
+ data[i] = ao_usb_getchar();
+ ao_flash_page(p, (void *) data);
}
static void
diff --git a/src/product/ao_micropeak.c b/src/product/ao_micropeak.c
new file mode 100644
index 00000000..10f0d192
--- /dev/null
+++ b/src/product/ao_micropeak.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * 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; 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_micropeak.h>
+#include <ao_ms5607.h>
+#include <ao_log_micro.h>
+#include <ao_async.h>
+
+static struct ao_ms5607_sample sample;
+static struct ao_ms5607_value value;
+
+alt_t ground_alt, max_alt;
+alt_t ao_max_height;
+
+void
+ao_pa_get(void)
+{
+ ao_ms5607_sample(&sample);
+ ao_ms5607_convert(&sample, &value);
+ pa = value.pres;
+}
+
+static void
+ao_compute_height(void)
+{
+ ground_alt = ao_pa_to_altitude(pa_ground);
+ max_alt = ao_pa_to_altitude(pa_min);
+ ao_max_height = max_alt - ground_alt;
+}
+
+static void
+ao_pips(void)
+{
+ uint8_t i;
+ for (i = 0; i < 10; i++) {
+ ao_led_toggle(AO_LED_REPORT);
+ ao_delay(AO_MS_TO_TICKS(80));
+ }
+ ao_delay(AO_MS_TO_TICKS(200));
+}
+
+int
+main(void)
+{
+ ao_led_init(LEDS_AVAILABLE);
+ ao_timer_init();
+
+ /* Init external hardware */
+ ao_spi_init();
+ ao_ms5607_init();
+ ao_ms5607_setup();
+
+ /* Give the person a second to get their finger out of the way */
+ ao_delay(AO_MS_TO_TICKS(1000));
+
+ ao_log_micro_restore();
+ ao_compute_height();
+ ao_report_altitude();
+ ao_pips();
+ ao_log_micro_dump();
+
+ ao_delay(BOOST_DELAY);
+
+ ao_microflight();
+
+ ao_log_micro_save();
+ ao_compute_height();
+ ao_report_altitude();
+ for (;;) {
+ cli();
+ set_sleep_mode(SLEEP_MODE_PWR_DOWN);
+ sleep_mode();
+ }
+}
diff --git a/src/product/ao_micropeak.h b/src/product/ao_micropeak.h
new file mode 100644
index 00000000..0cefca6f
--- /dev/null
+++ b/src/product/ao_micropeak.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * 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; 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_MICROPEAK_H_
+#define _AO_MICROPEAK_H_
+
+#define SAMPLE_SLEEP AO_MS_TO_TICKS(96)
+
+/* 64 sample, or about six seconds worth */
+#define GROUND_AVG_SHIFT 6
+#define GROUND_AVG (1 << GROUND_AVG_SHIFT)
+
+/* Pressure change (in Pa) to detect boost */
+#define BOOST_DETECT 360 /* 30m at sea level, 36m at 2000m */
+
+/* Wait after power on before doing anything to give the user time to assemble the rocket */
+#define BOOST_DELAY AO_SEC_TO_TICKS(60)
+
+/* Pressure change (in Pa) to detect landing */
+#define LAND_DETECT 24 /* 2m at sea level, 2.4m at 2000m */
+
+/* Current sensor pressure value */
+extern uint32_t pa;
+
+/* Average pressure value on ground */
+extern uint32_t pa_ground;
+
+/* Minimum recorded filtered pressure value */
+extern uint32_t pa_min;
+
+/* Pressure values converted to altitudes */
+extern alt_t ground_alt, max_alt;
+
+/* max_alt - ground_alt */
+extern alt_t ao_max_height;
+
+void
+ao_pa_get(void);
+
+void
+ao_microflight(void);
+
+#define ACCEL_LOCK_PA -20
+#define ACCEL_LOCK_TIME 10
+
+extern uint32_t ao_k_pa; /* 24.8 fixed point */
+extern int32_t ao_k_pa_speed; /* 16.16 fixed point */
+extern int32_t ao_k_pa_accel; /* 16.16 fixed point */
+
+extern uint32_t ao_pa; /* integer portion */
+extern int16_t ao_pa_speed; /* integer portion */
+extern int16_t ao_pa_accel; /* integer portion */
+
+void
+ao_microkalman_init(void);
+
+void
+ao_microkalman_predict(void);
+
+void
+ao_microkalman_correct(void);
+
+#endif
+
diff --git a/src/product/ao_terraui.c b/src/product/ao_terraui.c
index 1866eb0c..8fd97033 100644
--- a/src/product/ao_terraui.c
+++ b/src/product/ao_terraui.c
@@ -629,7 +629,7 @@ ao_terragps(void)
for (;;) {
while (ao_gps_tick == gps_tick)
- ao_sleep(&ao_gps_data);
+ ao_sleep(&ao_gps_new);
gps_tick = ao_gps_tick;
ao_gps_progress = (ao_gps_progress + 1) & 3;
}