Rev 1821 | Rev 1868 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1821 | Rev 1845 | ||
---|---|---|---|
Line 88... | Line 88... | ||
88 | // The signal goes low for 65ms between pulses, |
88 | // The signal goes low for 65ms between pulses, |
89 | // so the cycle time is 65mS + the pulse width. |
89 | // so the cycle time is 65mS + the pulse width. |
90 | // pwm is high |
90 | // pwm is high |
Line 91... | Line 91... | ||
91 | 91 | ||
92 | if (debugCounter++ == 5000) { |
92 | if (debugCounter++ == 5000) { |
93 | DebugOut.Digital[0] ^= DEBUG_MK3MAG; |
93 | // DebugOut.Digital[0] ^= DEBUG_MK3MAG; |
94 | debugCounter = 0; |
94 | debugCounter = 0; |
Line 95... | Line 95... | ||
95 | } |
95 | } |
96 | 96 | ||
Line 111... | Line 111... | ||
111 | if ((PWMCount) && (PWMCount < 362)) { // 362 * 102.4us = 37.0688 ms |
111 | if ((PWMCount) && (PWMCount < 362)) { // 362 * 102.4us = 37.0688 ms |
112 | if (PWMCount < 10) |
112 | if (PWMCount < 10) |
113 | compassHeading = 0; |
113 | compassHeading = 0; |
114 | else { |
114 | else { |
115 | compassHeading = ((uint32_t) (PWMCount - 10) * 1049L) / 1024; // correct timebase and offset |
115 | compassHeading = ((uint32_t) (PWMCount - 10) * 1049L) / 1024; // correct timebase and offset |
116 | DebugOut.Digital[1] ^= DEBUG_MK3MAG; // correct signal recd. |
116 | //DebugOut.Digital[1] ^= DEBUG_MK3MAG; // correct signal recd. |
117 | } |
117 | } |
118 | /* |
118 | /* |
119 | compassHeading - compassCourse on a -180..179 range. |
119 | compassHeading - compassCourse on a -180..179 range. |
120 | compassHeading 20 compassCourse 30 --> ((540 - 10)%360) - 180 = -10 |
120 | compassHeading 20 compassCourse 30 --> ((540 - 10)%360) - 180 = -10 |
121 | compassHeading 30 compassCourse 20 --> ((540 + 10)%360) - 180 = 10 |
121 | compassHeading 30 compassCourse 20 --> ((540 + 10)%360) - 180 = 10 |