160 if (car0 == 0) tmp = car0_new-car0_old; |
160 if (car0 == 0) tmp = car0_new-car0_old; |
161 if ( (tmp > 54) && (tmp < 74) ) car0 = 1; |
161 if ( (tmp > 54) && (tmp < 74) ) car0 = 1; |
162 if ( (tmp > 118) && (tmp < 138) ) car0 = 2; |
162 if ( (tmp > 118) && (tmp < 138) ) car0 = 2; |
163 if ( (tmp > 186) && (tmp < 206) ) car0 = 3; |
163 if ( (tmp > 186) && (tmp < 206) ) car0 = 3; |
164 if ( (tmp > 246) && (tmp < 266) ) car0 = 4; |
164 if ( (tmp > 246) && (tmp < 266) ) car0 = 4; |
|
165 if ( (tmp > 310) && (tmp < 330) ) car0 = 5; |
|
166 if ( (tmp > 374) && (tmp < 394) ) car0 = 6; |
165 } |
167 } |
166 car0_old = car0_new; |
168 car0_old = car0_new; |
167 } |
169 } |
168 |
170 |
169 // ISR (TIMER1_CAPT_vect) { |
171 // ISR (TIMER1_CAPT_vect) { |
177 if (car1 == 0) tmp = car1_new-car1_old; |
179 if (car1 == 0) tmp = car1_new-car1_old; |
178 if ( (tmp > 50) && (tmp < 78) ) car1 = 1; |
180 if ( (tmp > 50) && (tmp < 78) ) car1 = 1; |
179 if ( (tmp > 114) && (tmp < 146) ) car1 = 2; |
181 if ( (tmp > 114) && (tmp < 146) ) car1 = 2; |
180 if ( (tmp > 183) && (tmp < 210) ) car1 = 3; |
182 if ( (tmp > 183) && (tmp < 210) ) car1 = 3; |
181 if ( (tmp > 242) && (tmp < 270) ) car1 = 4; |
183 if ( (tmp > 242) && (tmp < 270) ) car1 = 4; |
|
184 if ( (tmp > 310) && (tmp < 330) ) car1 = 5; |
|
185 if ( (tmp > 374) && (tmp < 394) ) car1 = 6; |
182 } |
186 } |
183 car1_old = car1_new; |
187 car1_old = car1_new; |
184 } |
188 } |
185 #else |
189 #else |
186 // ALTERNATIV: |
190 // ALTERNATIV: |
193 if (car1 == 0) tmp = car1_new-car1_old; |
197 if (car1 == 0) tmp = car1_new-car1_old; |
194 if ( (tmp > 50) && (tmp < 78) ) car1 = 1; |
198 if ( (tmp > 50) && (tmp < 78) ) car1 = 1; |
195 if ( (tmp > 114) && (tmp < 146) ) car1 = 2; |
199 if ( (tmp > 114) && (tmp < 146) ) car1 = 2; |
196 if ( (tmp > 183) && (tmp < 210) ) car1 = 3; |
200 if ( (tmp > 183) && (tmp < 210) ) car1 = 3; |
197 if ( (tmp > 242) && (tmp < 270) ) car1 = 4; |
201 if ( (tmp > 242) && (tmp < 270) ) car1 = 4; |
|
202 if ( (tmp > 310) && (tmp < 330) ) car1 = 5; |
|
203 if ( (tmp > 374) && (tmp < 394) ) car1 = 6; |
198 } |
204 } |
199 car1_old = car1_new; |
205 car1_old = car1_new; |
200 } |
206 } |
201 #endif |
207 #endif |
202 |
208 |