Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
authorBdale Garbee <bdale@gag.com>
Wed, 5 Feb 2020 18:48:13 +0000 (11:48 -0700)
committerBdale Garbee <bdale@gag.com>
Wed, 5 Feb 2020 18:48:13 +0000 (11:48 -0700)
21 files changed:
altosdroid/Makefile.am
altosdroid/app/build.gradle [deleted file]
altosdroid/app/build.gradle.in [new file with mode: 0644]
configure.ac
src/drivers/ao_btm.c
src/drivers/ao_lco.c
src/drivers/ao_lco.h
src/drivers/ao_lco_bits.c
src/drivers/ao_lco_cmd.c
src/drivers/ao_lco_func.c
src/drivers/ao_pad.c
src/kernel/ao_boot.h
src/lpc/ao_boot_pin.c
src/lpc/ao_interrupt.c
src/stm/ao_boot_pin.c
src/stm/ao_interrupt.c
src/stmf0/ao_boot_pin.c
src/stmf0/ao_interrupt.c
src/telelco-v2.0/ao_lco_v2.c
src/telemini-v3.0/ao_pins.h
src/telemini-v3.0/ao_telemini.c

index 3a4edde17044256d1833be3e85df8ccbc5a03d2e..7fb16404d776cc27a681ee6a87ed7bc183c2b92c 100644 (file)
@@ -40,7 +40,7 @@ DRAWABLES=\
     $(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
diff --git a/altosdroid/app/build.gradle b/altosdroid/app/build.gradle
deleted file mode 100644 (file)
index 1d97693..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-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'])
-}
-
diff --git a/altosdroid/app/build.gradle.in b/altosdroid/app/build.gradle.in
new file mode 100644 (file)
index 0000000..cc29d86
--- /dev/null
@@ -0,0 +1,47 @@
+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'])
+}
+
index 76b5e57ac913e1d0555dfcf96b67a8995ef79e28..91db92ae26adf4280f00e216341838494b48c4fe 100644 (file)
@@ -19,7 +19,7 @@ dnl Process this file with autoconf to create configure.
 
 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
@@ -166,9 +166,7 @@ fi
 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
@@ -556,6 +554,7 @@ telegps/telegps-windows.nsi
 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
index 71599fbd6665b11d7e1ec184b2f2477622a68a32..b7ff0b9edb4d383da76e414ae1b67baccc0bd1dc 100644 (file)
@@ -32,7 +32,7 @@
 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];
index b314ef7c0273acf55f8ab277ed927bc05917c363..0d7e4cba2debfca344168ccad24065cb4a94cbb1 100644 (file)
@@ -37,7 +37,7 @@
 #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;
@@ -124,10 +124,10 @@ ao_lco_box_present(uint16_t box)
 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
@@ -135,14 +135,14 @@ ao_lco_drag_button_check(uint16_t now, uint16_t delay)
         */
        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;
                        }
@@ -158,14 +158,14 @@ ao_lco_drag_button_check(uint16_t now, uint16_t delay)
 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);
index cdc19d3d76837a7d7627d5dd250eb431005733cf..3b123793d7ff4d8327e4d837e2ee8dddc7df1867 100644 (file)
@@ -107,12 +107,12 @@ void
 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
index 6e50e44db4f8bec93edf71a42ab72a8f940f64c2..bc54dc22b8ab9992d4b8b2a0419fc9774a62e228 100644 (file)
@@ -33,7 +33,7 @@ uint8_t               ao_lco_drag_race;
 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
@@ -322,7 +322,7 @@ ao_lco_search(void)
 void
 ao_lco_monitor(void)
 {
-       uint16_t                delay;
+       AO_TICK_TYPE            delay;
        uint8_t                 box;
 
        for (;;) {
@@ -358,8 +358,8 @@ ao_lco_monitor(void)
 
 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)
@@ -391,14 +391,14 @@ ao_lco_toggle_drag(void)
  * 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");
@@ -418,7 +418,7 @@ ao_lco_drag_beep_check(uint16_t now, uint16_t delay)
        }
 
        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;
@@ -463,13 +463,13 @@ ao_lco_drag_disable(void)
  * 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;
                }
index 6f195e550cfc909063984a0115a9163807038da5..0184363533390736f2e831f829285e8a83e6e676 100644 (file)
@@ -28,7 +28,6 @@
 
 static uint16_t        lco_box;
 static uint8_t lco_channels;
-static uint16_t        tick_offset;
 
 static void
 lco_args(void) 
index 06350694145d4bda978ac894eb2a011160543ada..1960683fa6b214a56cd7fd87800cd1a7c6e7562d 100644 (file)
@@ -28,8 +28,8 @@ int8_t
 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) {
@@ -62,7 +62,7 @@ void
 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;
index 2592a084261bec25640f0820dfc018c579f44486..07c49afc6b890a4094a842360223eddc52eef715 100644 (file)
@@ -26,10 +26,10 @@ static uint8_t ao_pad_ignite;
 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
@@ -288,7 +288,7 @@ ao_pad_monitor(void)
                        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) {
@@ -369,7 +369,7 @@ static int ao_pad_read_box(void) {
 static void
 ao_pad(void)
 {
-       int16_t time_difference;
+       int16_t tick_difference;
        int8_t  ret;
 
        ao_pad_box = 0;
@@ -398,12 +398,12 @@ ao_pad(void)
                        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) {
@@ -439,7 +439,7 @@ ao_pad(void)
                                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;
@@ -457,7 +457,7 @@ ao_pad(void)
 #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;
index 0977cf657fffc8bbd9b72f2f78e72d72dcba6130..c11aac1ed2462b2e933751ec1afd79931b1a96e8 100644 (file)
@@ -22,7 +22,8 @@
 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) */
index a51c7f8d45414d59eb9a47b47adeb54714ebefdd..91acbfd492bc29cddc2cbca1cccc0c27c81784db 100644 (file)
 #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);
@@ -41,7 +38,5 @@ ao_boot_check_pin(void)
        /* 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;
 }
index 8d71f43f2de38c1f0216d17d18d14b02e82e9559..a479ec6d59585835c508e6e2cff7ce8db47e0c13 100644 (file)
@@ -53,8 +53,11 @@ void start(void) {
 #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
index 4b5dc2ac480341086e4264284b9345d2e5da299c..f21ce1b251ff5931d5609ebb1926b6d2d68966ed 100644 (file)
@@ -20,7 +20,7 @@
 #include <ao_boot.h>
 #include <ao_exti.h>
 
-void
+int
 ao_boot_check_pin(void)
 {
        uint16_t v;
@@ -42,6 +42,5 @@ ao_boot_check_pin(void)
        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;
 }
index d8be36670baf608726adfa910b9aa70e4b31d5ed..1d563532b755cf7f1144400803ef0a034536febb 100644 (file)
@@ -77,8 +77,11 @@ void start(void)
 #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 */
index 4b5dc2ac480341086e4264284b9345d2e5da299c..f21ce1b251ff5931d5609ebb1926b6d2d68966ed 100644 (file)
@@ -20,7 +20,7 @@
 #include <ao_boot.h>
 #include <ao_exti.h>
 
-void
+int
 ao_boot_check_pin(void)
 {
        uint16_t v;
@@ -42,6 +42,5 @@ ao_boot_check_pin(void)
        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;
 }
index 0025de47153445bbf6d5df961c54726dab0d4c23..1ee6e720091be2e277fca3b26536fd559caea35d 100644 (file)
@@ -72,8 +72,11 @@ void start(void)
 #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 */
index 904dea0fe501f039e685366ae4b1d4664b916576..1238d72f01dae3316ab352d00d47ad558fe12fce 100644 (file)
@@ -151,13 +151,13 @@ static struct ao_task     ao_lco_drag_task;
 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);
index d91b1d21fcf8d04374fc4efe3029b3a72f134c20..ae8534b9c3fbaf56ef3545f42dcaf6296273da3d 100644 (file)
@@ -74,9 +74,9 @@
 #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
 
index bb3bc05424e2083eee81bc61cbde082a8b5a8876..d571d340f38919ee46f9ed6dd2f8ab1dd013b903 100644 (file)
@@ -19,6 +19,7 @@
 #include <ao.h>
 #include <ao_exti.h>
 
+#if HAS_FORCE_FREQ
 static void
 ao_check_recovery(void)
 {
@@ -33,11 +34,14 @@ 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();