Date:2012-12-15 08:53:57 (6 years 11 months ago)
Author:Werner Almesberger
Commit:2dc2fb278cf17368265e066d025c2584d640f1a7
Message:tornado/fw/tornado.c: update signal processing from sim/alg.c

Files: tornado/fw/tornado.c (4 diffs)

Change Details

tornado/fw/tornado.c
9696}
9797
9898
99#define E_SHIFT 3 /* ~ 0.1 */
100#define M_SHIFT 11 /* ~ 1/sample_rate */
99#define E_SHIFT 8 /* ~ 0.06 */
100#define M_SHIFT 11 /* ~ 2/sample_rate */
101101
102#define HYSTERESIS 14
102#define HYSTERESIS 9 /* 1 g / 3 */
103103
104104
105105static const uint8_t img[] PROGMEM = {
...... 
115115
116116static void zxing(uint16_t x, uint16_t y)
117117{
118    static uint16_t e = 512 << E_SHIFT;
119    static uint32_t m = 512 << M_SHIFT;
118    static uint32_t e = (uint32_t) 512 << E_SHIFT;
119    static uint32_t m = (uint32_t) 512 << M_SHIFT;
120120    int16_t d;
121121    static bool up = 0;
122122    static bool on = 0;
...... 
125125
126126    sample_t++;
127127    sample_v = x;
128return;
129128
130    e = y+(e-(e >> E_SHIFT));
131    m = y+(m-(m >> M_SHIFT));
129    e = x+(e-(e >> E_SHIFT));
130    m = x+(m-(m >> M_SHIFT));
132131    d = (e >> E_SHIFT)-(m >> M_SHIFT);
133132    if (up) {
134133        if (d < -HYSTERESIS)
...... 
227226    uint32_t n = 0;
228227
229228    sample = zxing;
229    /* MMC doesn't work when running from battery, probably because we
230       have no regulation. Just disable it for now. */
231#if 0
230232    if (!mmc_init())
231233        panic();
234#endif
232235    accel_start();
233236    sei();
237while (1);
234238    while (1) {
235239        uint16_t t, v;
236240

Archive Download the corresponding diff file

Branches:
master
tornado-v1



interactive