Change Details
| tornado/fw/tornado.c |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 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 */ |
| 101 | 101 | |
| 102 | | #define HYSTERESIS 14 |
| 102 | #define HYSTERESIS 9 /* 1 g / 3 */ |
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | static const uint8_t img[] PROGMEM = { |
| ... | ... | |
| 115 | 115 | |
| 116 | 116 | static void zxing(uint16_t x, uint16_t y) |
| 117 | 117 | { |
| 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; |
| 120 | 120 | int16_t d; |
| 121 | 121 | static bool up = 0; |
| 122 | 122 | static bool on = 0; |
| ... | ... | |
| 125 | 125 | |
| 126 | 126 | sample_t++; |
| 127 | 127 | sample_v = x; |
| 128 | | return; |
| 129 | 128 | |
| 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)); |
| 132 | 131 | d = (e >> E_SHIFT)-(m >> M_SHIFT); |
| 133 | 132 | if (up) { |
| 134 | 133 | if (d < -HYSTERESIS) |
| ... | ... | |
| 227 | 226 | uint32_t n = 0; |
| 228 | 227 | |
| 229 | 228 | 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 |
| 230 | 232 | if (!mmc_init()) |
| 231 | 233 | panic(); |
| 234 | #endif |
| 232 | 235 | accel_start(); |
| 233 | 236 | sei(); |
| 237 | while (1); |
| 234 | 238 | while (1) { |
| 235 | 239 | uint16_t t, v; |
| 236 | 240 | |
Download the corresponding diff file