$(DRAWABLE_DIR)/greenled.png \
$(DRAWABLE_DIR)/grayled.png
-GRADLEW=bash ./gradlew --no-daemon
+GRADLEW=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 bash ./gradlew --no-daemon
LAYOUTS=$(LAYOUT_DIR)/*.xml
MENUS=$(MENU_DIR)/*.xml
+++ /dev/null
-apply plugin: 'com.android.application'
-
-def keystorePropertiesFile = file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.properties")
-def keystoreProperties = new Properties()
-keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
-
-android {
- signingConfigs {
- release {
- storeFile file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.jks")
- storePassword keystoreProperties['storePassword']
- keyAlias keystoreProperties['keyAlias']
- keyPassword keystoreProperties['keyPassword']
- }
- }
-
- compileSdkVersion 28
- defaultConfig {
- applicationId "org.altusmetrum.AltosDroid"
- minSdkVersion 26
- targetSdkVersion 28
- versionCode 19
- versionName "1.9.1rc1"
- }
- buildTypes {
- release {
- signingConfig signingConfigs.release
- minifyEnabled false
- debuggable false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- debug {
- debuggable true
- }
- }
- lintOptions {
- abortOnError false
- }
-}
-
-dependencies {
- implementation 'androidx.appcompat:appcompat:1.0.0'
- implementation 'androidx.legacy:legacy-support-v4:1.0.0'
- implementation 'com.google.android.gms:play-services-maps:17.0.0'
- implementation fileTree(dir: 'libs', include: ['*.jar'])
-}
-
--- /dev/null
+apply plugin: 'com.android.application'
+
+def keystorePropertiesFile = file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.properties")
+def keystoreProperties = new Properties()
+keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
+
+android {
+ signingConfigs {
+ release {
+ storeFile file(System.properties['user.home'] + "/altusmetrumllc/android_keystore.jks")
+ storePassword keystoreProperties['storePassword']
+ keyAlias keystoreProperties['keyAlias']
+ keyPassword keystoreProperties['keyPassword']
+ }
+ }
+
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "org.altusmetrum.AltosDroid"
+ minSdkVersion 21
+ targetSdkVersion 28
+ versionCode @ANDROID_VERSION@
+ versionName "@VERSION@"
+ }
+ buildTypes {
+ release {
+ signingConfig signingConfigs.release
+ minifyEnabled false
+ debuggable false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ debuggable true
+ }
+ }
+ lintOptions {
+ abortOnError false
+ }
+}
+
+dependencies {
+ implementation 'androidx.appcompat:appcompat:1.0.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'com.google.android.gms:play-services-maps:17.0.0'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+}
+
AC_PREREQ(2.57)
AC_INIT([altos], 1.9.1)
-ANDROID_VERSION=18
+ANDROID_VERSION=20
AC_CONFIG_SRCDIR([src/kernel/ao.h])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
ANDROID_RELEASE=no
if test "x$ANDROID_SDK" != "xno"; then
HAVE_ANDROID_SDK="yes"
- if test -f "$HOME/altusmetrumllc/google-play-release.keystore" -a -f "$HOME/altusmetrumllc/google-play-passphrase"; then
- ANDROID_RELEASE=yes
- fi
+ ANDROID_RELEASE=yes
else
HAVE_ANDROID_SDK="no"
fi
altosdroid/Makefile
altosdroid/local.properties
altosdroid/app/src/main/AndroidManifest.xml
+altosdroid/app/build.gradle
ao-tools/Makefile
ao-tools/lib/Makefile
ao-tools/ao-rawload/Makefile
int8_t ao_btm_stdio;
uint8_t ao_btm_connected;
-#define BT_DEBUG 1
+#define BT_DEBUG 0
#if BT_DEBUG
char ao_btm_buffer[256];
#define AO_LCO_BOX_DRAG 0x1000
/* UI values */
-static uint16_t ao_lco_fire_tick;
+static AO_TICK_TYPE ao_lco_fire_tick;
static uint8_t ao_lco_fire_down;
static uint8_t ao_lco_display_mutex;
static struct ao_task ao_lco_drag_task;
static uint8_t ao_lco_drag_active;
-static uint16_t
-ao_lco_drag_button_check(uint16_t now, uint16_t delay)
+static AO_TICK_TYPE
+ao_lco_drag_button_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
{
- uint16_t button_delay = ~0;
+ AO_TICK_TYPE button_delay = ~0;
/*
* Check to see if the button has been held down long enough
*/
if (ao_lco_fire_down) {
if (ao_lco_drag_race) {
- if ((int16_t) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_STOP_TIME) {
+ if ((AO_TICK_SIGNED) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_STOP_TIME) {
ao_lco_drag_disable();
ao_lco_fire_down = 0;
}
else
button_delay = ao_lco_fire_tick + AO_LCO_DRAG_RACE_STOP_TIME - now;
} else {
- if ((int16_t) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_START_TIME) {
+ if ((AO_TICK_SIGNED) (now - ao_lco_fire_tick) >= AO_LCO_DRAG_RACE_START_TIME) {
ao_lco_drag_enable();
ao_lco_fire_down = 0;
}
static void
ao_lco_drag_monitor(void)
{
- uint16_t delay = ~0;
- uint16_t now;
+ AO_TICK_TYPE delay = ~0;
+ AO_TICK_TYPE now;
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);
- if (delay == (uint16_t) ~0)
+ if (delay == (AO_TICK_TYPE) ~0)
ao_sleep(&ao_lco_drag_beep_count);
else
ao_sleep_for(&ao_lco_drag_beep_count, delay);
ao_lco_drag_disable(void);
/* Handle drag beeps, return new delay */
-uint16_t
-ao_lco_drag_beep_check(uint16_t now, uint16_t delay);
+AO_TICK_TYPE
+ao_lco_drag_beep_check(AO_TICK_TYPE now, AO_TICK_TYPE delay);
/* Check if it's time to beep during drag race. Return new delay */
-uint16_t
-ao_lco_drag_warn_check(uint16_t now, uint16_t delay);
+AO_TICK_TYPE
+ao_lco_drag_warn_check(AO_TICK_TYPE now, AO_TICK_TYPE delay);
/* Request 'beeps' additional drag race beeps */
void
struct ao_pad_query ao_pad_query; /* latest query response */
static uint8_t ao_lco_channels[AO_PAD_MAX_BOXES]; /* pad channels available on each box */
-static uint16_t ao_lco_tick_offset[AO_PAD_MAX_BOXES]; /* offset from local to remote tick count */
+static uint16_t ao_lco_tick_offset[AO_PAD_MAX_BOXES]; /* 16 bit offset from local to remote tick count */
static uint8_t ao_lco_selected[AO_PAD_MAX_BOXES]; /* pads selected to fire */
#define AO_LCO_VALID_LAST 1
void
ao_lco_monitor(void)
{
- uint16_t delay;
+ AO_TICK_TYPE delay;
uint8_t box;
for (;;) {
uint8_t ao_lco_drag_beep_count;
static uint8_t ao_lco_drag_beep_on;
-static uint16_t ao_lco_drag_beep_time;
-static uint16_t ao_lco_drag_warn_time;
+static AO_TICK_TYPE ao_lco_drag_beep_time;
+static AO_TICK_TYPE ao_lco_drag_warn_time;
#define AO_LCO_DRAG_BEEP_TIME AO_MS_TO_TICKS(50)
#define AO_LCO_DRAG_WARN_TIME AO_SEC_TO_TICKS(5)
* turn it on or off as necessary and bump the remaining beep counts
*/
-uint16_t
-ao_lco_drag_beep_check(uint16_t now, uint16_t delay)
+AO_TICK_TYPE
+ao_lco_drag_beep_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
{
PRINTD("beep check count %d delta %d\n",
ao_lco_drag_beep_count,
- (int16_t) (now - ao_lco_drag_beep_time));
+ (AO_TICK_SIGNED) (now - ao_lco_drag_beep_time));
if (ao_lco_drag_beep_count) {
- if ((int16_t) (now - ao_lco_drag_beep_time) >= 0) {
+ if ((AO_TICK_SIGNED) (now - ao_lco_drag_beep_time) >= 0) {
if (ao_lco_drag_beep_on) {
ao_beep(0);
PRINTD("beep stop\n");
}
if (ao_lco_drag_beep_count) {
- uint16_t beep_delay = 0;
+ AO_TICK_TYPE beep_delay = 0;
if (ao_lco_drag_beep_time > now)
beep_delay = ao_lco_drag_beep_time - now;
* active
*/
-uint16_t
-ao_lco_drag_warn_check(uint16_t now, uint16_t delay)
+AO_TICK_TYPE
+ao_lco_drag_warn_check(AO_TICK_TYPE now, AO_TICK_TYPE delay)
{
if (ao_lco_drag_race) {
- uint16_t warn_delay;
+ AO_TICK_TYPE warn_delay;
- if ((int16_t) (now - ao_lco_drag_warn_time) >= 0) {
+ if ((AO_TICK_SIGNED) (now - ao_lco_drag_warn_time) >= 0) {
ao_lco_drag_add_beeps(1);
ao_lco_drag_warn_time = now + AO_LCO_DRAG_WARN_TIME;
}
static uint16_t lco_box;
static uint8_t lco_channels;
-static uint16_t tick_offset;
static void
lco_args(void)
ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset)
{
int8_t r;
- uint16_t sent_time;
- uint16_t timeout = AO_MS_TO_TICKS(10);
+ AO_TICK_TYPE sent_time;
+ AO_TICK_TYPE timeout = AO_MS_TO_TICKS(10);
#if HAS_RADIO_RATE
switch (ao_config.radio_rate) {
ao_lco_arm(uint16_t box, uint8_t channels, uint16_t tick_offset)
{
ao_mutex_get(&ao_lco_mutex);
- command.tick = ao_time() - tick_offset;
+ command.tick = (uint16_t) ao_time() - tick_offset;
command.box = box;
command.cmd = AO_PAD_ARM;
command.channels = channels;
static struct ao_pad_command command;
static struct ao_pad_query query;
static uint8_t ao_pad_armed;
-static uint16_t ao_pad_arm_time;
+static AO_TICK_TYPE ao_pad_arm_time;
static uint8_t ao_pad_box;
static uint8_t ao_pad_disabled;
-static uint16_t ao_pad_packet_time;
+static AO_TICK_TYPE ao_pad_packet_time;
#ifndef AO_PAD_RSSI_MINIMUM
#define AO_PAD_RSSI_MINIMUM -90
prev = cur;
}
- if (ao_pad_armed && (int16_t) (ao_time() - ao_pad_arm_time) > AO_PAD_ARM_TIME)
+ if (ao_pad_armed && (AO_TICK_SIGNED) (ao_time() - ao_pad_arm_time) > AO_PAD_ARM_TIME)
ao_pad_armed = 0;
if (ao_pad_armed) {
static void
ao_pad(void)
{
- int16_t time_difference;
+ int16_t tick_difference;
int8_t ret;
ao_pad_box = 0;
if (command.channels & ~(AO_PAD_ALL_CHANNELS))
break;
- time_difference = command.tick - ao_time();
- PRINTD ("arm tick %d local tick %d\n", command.tick, ao_time());
- if (time_difference < 0)
- time_difference = -time_difference;
- if (time_difference > 10) {
- PRINTD ("time difference too large %d\n", time_difference);
+ tick_difference = command.tick - (uint16_t) ao_time();
+ PRINTD ("arm tick %d local tick %d\n", command.tick, (uint16_t) ao_time());
+ if (tick_difference < 0)
+ tick_difference = -tick_difference;
+ if (tick_difference > 10) {
+ PRINTD ("tick difference too large %d\n", tick_difference);
break;
}
if (query.arm_status != AO_PAD_ARM_STATUS_ARMED) {
PRINTD ("not armed\n");
break;
}
- if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
+ 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());
break;
#if HAS_LOG
if (!ao_log_running) ao_log_start();
#endif
- if ((uint16_t) (ao_time() - ao_pad_arm_time) > AO_SEC_TO_TICKS(20)) {
+ 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());
break;
void
ao_boot_chain(uint32_t *base);
-void
+/* Return true to switch to application */
+int
ao_boot_check_pin(void);
/* Return true to switch to application (if present) */
#include <ao_boot.h>
#include <ao_exti.h>
-void
+int
ao_boot_check_pin(void)
{
uint16_t v;
- /* Enable power interface clock */
-// stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_PWREN);
-
/* Enable the input pin */
ao_enable_input(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN,
AO_BOOT_APPLICATION_MODE);
/* Reset the chip to turn off the port and the power interface clock */
ao_gpio_set_mode(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
ao_disable_port(AO_BOOT_APPLICATION_GPIO);
-// stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_PWREN);
- if (v == AO_BOOT_APPLICATION_VALUE)
- ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+ return v == AO_BOOT_APPLICATION_VALUE;
}
#ifdef AO_BOOT_CHAIN
if (ao_boot_check_chain()) {
#ifdef AO_BOOT_PIN
- ao_boot_check_pin();
+ if (ao_boot_check_pin())
#endif
+ {
+ ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+ }
}
#endif
#if RELOCATE_INTERRUPT
#include <ao_boot.h>
#include <ao_exti.h>
-void
+int
ao_boot_check_pin(void)
{
uint16_t v;
ao_gpio_set_mode(&AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
ao_disable_port(&AO_BOOT_APPLICATION_GPIO);
stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_PWREN);
- if (v == AO_BOOT_APPLICATION_VALUE)
- ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+ return v == AO_BOOT_APPLICATION_VALUE;
}
#ifdef AO_BOOT_CHAIN
if (ao_boot_check_chain()) {
#ifdef AO_BOOT_PIN
- ao_boot_check_pin();
+ if (ao_boot_check_pin())
#endif
+ {
+ ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+ }
}
#endif
/* Set interrupt vector table offset */
#include <ao_boot.h>
#include <ao_exti.h>
-void
+int
ao_boot_check_pin(void)
{
uint16_t v;
ao_gpio_set_mode(&AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
ao_disable_port(&AO_BOOT_APPLICATION_GPIO);
stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_PWREN);
- if (v == AO_BOOT_APPLICATION_VALUE)
- ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+ return v == AO_BOOT_APPLICATION_VALUE;
}
#if AO_BOOT_CHAIN
if (ao_boot_check_chain()) {
#if AO_BOOT_PIN
- ao_boot_check_pin();
+ if (ao_boot_check_pin())
#endif
+ {
+ ao_boot_chain(AO_BOOT_APPLICATION_BASE);
+ }
}
#endif
/* Turn on syscfg */
static void
ao_lco_drag_monitor(void)
{
- uint16_t delay = ~0;
- uint16_t now;
+ AO_TICK_TYPE delay = ~0;
+ AO_TICK_TYPE now;
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);
- if (delay == (uint16_t) ~0)
+ if (delay == (AO_TICK_TYPE) ~0)
ao_sleep(&ao_lco_drag_beep_count);
else
ao_sleep_for(&ao_lco_drag_beep_count, delay);
#define AO_RECOVERY_VALUE 0
#define AO_RECOVERY_MODE AO_EXTI_MODE_PULL_UP
-/* Beeper is on Tim3 CH4 */
+/* Beeper is on Tim2 CH4 */
#define BEEPER_CHANNEL 4
-#define BEEPER_TIMER 3
+#define BEEPER_TIMER 2
#define BEEPER_PORT (&stm_gpioa)
#define BEEPER_PIN 3
#include <ao.h>
#include <ao_exti.h>
+#if HAS_FORCE_FREQ
static void
ao_check_recovery(void)
{
ao_gpio_set_mode(AO_RECOVERY_PORT, AO_RECOVERY_PIN, 0);
ao_disable_port(AO_RECOVERY_PORT);
}
+#endif
int
main(void)
{
+#if HAS_FORCE_FREQ
ao_check_recovery();
+#endif
ao_clock_init();
ao_task_init();