comparison src/start.asm @ 236:e2ea74646127

configure hardware_flag byte
author heinrichsweikamp
date Wed, 25 Feb 2015 22:19:30 +0100
parents 23311219dacc
children ee81f46714cb
comparison
equal deleted inserted replaced
235:23311219dacc 236:e2ea74646127
254 clrf flag9 254 clrf flag9
255 clrf flag10 255 clrf flag10
256 clrf hardware_flag ; hardware descriptor flag 256 clrf hardware_flag ; hardware descriptor flag
257 bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! 257 bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor!
258 258
259 ; configure hardware_flag byte
260
261 bsf ambient_sensor ; Clear flag
262 bsf optical_input ; Clear flag
263
259 call lt2942_get_status ; Check for gauge IC 264 call lt2942_get_status ; Check for gauge IC
260 btfsc rechargeable ; cR hardware? 265 btfss rechargeable ; cR hardware?
266 bra restart2 ; No
267
261 call lt2942_init ; Yes, init battery gauge IC 268 call lt2942_init ; Yes, init battery gauge IC
262 269 bsf analog_o2_input ; Set flag
270 bcf ambient_sensor ; Clear flag
271 bcf optical_input ; Clear flag
272
273 restart2:
263 ; Select high altitude (Fly) mode? 274 ; Select high altitude (Fly) mode?
264 movff last_surfpressure_30min+0,sub_b+0 275 movff last_surfpressure_30min+0,sub_b+0
265 movff last_surfpressure_30min+1,sub_b+1 276 movff last_surfpressure_30min+1,sub_b+1
266 movlw HIGH high_altitude_threshold 277 movlw HIGH high_altitude_threshold
267 movwf sub_a+1 278 movwf sub_a+1
269 movwf sub_a+0 280 movwf sub_a+0
270 call subU16 ; sub_c = sub_a - sub_b 281 call subU16 ; sub_c = sub_a - sub_b
271 btfss neg_flag ; Result negative (Ambient>880mbar)? 282 btfss neg_flag ; Result negative (Ambient>880mbar)?
272 bsf high_altitude_mode ; No, Set Flag! 283 bsf high_altitude_mode ; No, Set Flag!
273 284
274 btfss rechargeable 285 btfss analog_o2_input
275 bsf TRISB,3 286 bsf TRISB,3
276 btfss rechargeable 287 btfss rechargeable
277 bsf TRISG,0 288 bsf TRISG,0
278 call ext_flash_disable_protection ; Disable write protection for external flash 289 call ext_flash_disable_protection ; Disable write protection for external flash
279 290