comparison src/start.asm @ 429:4b93354b7738

hardware_flag handling
author heinrichsweikamp
date Thu, 16 Jun 2016 13:21:46 +0200
parents ceb1b7329dce
children 360acdcda0d7
comparison
equal deleted inserted replaced
428:eccae727702f 429:4b93354b7738
247 extern option_save_all, option_check_all 247 extern option_save_all, option_check_all
248 248
249 btfsc menubit ; Return from Menu/COMM mode or timeout? 249 btfsc menubit ; Return from Menu/COMM mode or timeout?
250 call option_save_all ; Yes, save all settings into EEPROM 250 call option_save_all ; Yes, save all settings into EEPROM
251 251
252 call option_restore_all ; Restore everything from EEPROM 252 call option_restore_all ; Restore everything from EEPROM into RAM
253 call option_check_all ; Check all options (and reset if not within their min/max boundaries) 253 call option_check_all ; Check all options (and reset if not within their min/max boundaries)
254 call option_save_all ; Save all settings into EEPROM after they have been checked 254 call option_save_all ; Save all settings into EEPROM after they have been checked
255 255
256 clrf flag1 ; clear all flags 256 clrf flag1 ; clear all flags
257 clrf flag2 257 clrf flag2
258 clrf flag3 258 clrf flag3
259 clrf flag4 259 clrf flag4
260 clrf flag5 260 clrf flag5
261 clrf flag6 261 clrf flag6
262 clrf flag7 262 clrf flag7
263 clrf flag8 263 clrf flag8
264 clrf flag9 264 clrf flag9
265 clrf flag10 265 clrf flag10
266 ; Do not clear flag11 (Sensor calibration and charger status) 266 ; Do not clear flag11 (Sensor calibration and charger status)
267 clrf flag12 267 clrf flag12
268 clrf flag13 268 clrf flag13
269 clrf hardware_flag ; hardware descriptor flag 269 clrf hardware_flag ; hardware descriptor flag
270 bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! 270 bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor!
271 271
272 ; configure hardware_flag byte 272 ; configure hardware_flag byte
273 273
274 bsf ambient_sensor ; Clear flag 274 bsf ambient_sensor ; Set flag
275 bsf optical_input ; Clear flag 275 bsf optical_input ; Set flag
276 276
277 call lt2942_get_status ; Check for gauge IC 277 call lt2942_get_status ; Check for gauge IC
278 btfss rechargeable ; cR hardware? 278 btfss rechargeable ; cR/2 hardware?
279 bra restart2 ; No 279 bra restart2 ; No
280 280
281 call lt2942_init ; Yes, init battery gauge IC 281 call lt2942_init ; Yes, init battery gauge IC
282 bcf optical_input ; Clear flag
283
284 bcf ANCON0,7 ; AN7 Digital input
285 bcf lightsen_power ; Power-down ambient light sensor
282 bcf ambient_sensor ; Clear flag 286 bcf ambient_sensor ; Clear flag
283 bcf optical_input ; Clear flag 287 btfss PORTF,2 ; Light sensor available?
284 288 bsf ambient_sensor ; Yes.
289 bsf ANCON0,7 ; AN7 Analog again
290 bsf lightsen_power ; Power-up ambient light sensor
291
285 restart2: 292 restart2:
286 btfsc vusb_in 293 btfsc vusb_in
287 bra restart3 ; USB (and powered on) 294 bra restart3 ; USB (and powered on)
288 bcf PORTE,0 ; Start comms 295 bcf PORTE,0 ; Start comms
289 WAITMS d'1' 296 WAITMS d'1'
301 ; The hardware_flag is now: 308 ; The hardware_flag is now:
302 ; 3: 0x0A 309 ; 3: 0x0A
303 ; cR: 0x05 310 ; cR: 0x05
304 ; 2 with BLE: 0x11 311 ; 2 with BLE: 0x11
305 ; 3 with BLE: 0x1A 312 ; 3 with BLE: 0x1A
313 ; 2 with ambient: 0x13
306 314
307 ; Select high altitude (Fly) mode? 315 ; Select high altitude (Fly) mode?
308 movff last_surfpressure_30min+0,sub_b+0 316 movff last_surfpressure_30min+0,sub_b+0
309 movff last_surfpressure_30min+1,sub_b+1 317 movff last_surfpressure_30min+1,sub_b+1
310 movlw HIGH high_altitude_threshold 318 movlw HIGH high_altitude_threshold