Mercurial > public > hwos_code
comparison src/adc_lightsensor.asm @ 645:070528a88715
3.16 release
author | heinrichsweikamp |
---|---|
date | Sun, 07 Nov 2021 12:39:23 +0100 |
parents | 7d8a4c60ec1a |
children | ef2ed7e3a895 |
comparison
equal
deleted
inserted
replaced
644:1e695355dfc4 | 645:070528a88715 |
---|---|
260 return ; YES - abort | 260 return ; YES - abort |
261 banksel HW_descriptor ; NO - select bank where hardware descriptor is stored | 261 banksel HW_descriptor ; NO - select bank where hardware descriptor is stored |
262 btfsc ambient_sensor ; - ambient sensor available? | 262 btfsc ambient_sensor ; - ambient sensor available? |
263 bra get_ambient_level1 ; YES - use sensor | 263 bra get_ambient_level1 ; YES - use sensor |
264 banksel isr_backup ; NO - back to ISR default bank | 264 banksel isr_backup ; NO - back to ISR default bank |
265 movff opt_brightness,isr_lo ; - get brightness selection | 265 movff brightness,isr_lo ; - get brightness selection |
266 incf isr_lo,F ; - 0-2 -> 1-3 | 266 incf isr_lo,F ; - 0-2 -> 1-3 |
267 movlw ambient_light_max_high_cr ; - default selection to brightest setting | 267 movlw ambient_light_max_high_cr ; - default selection to brightest setting |
268 dcfsnz isr_lo,F ; - level 0 (eco) selected? | 268 dcfsnz isr_lo,F ; - level 0 (eco) selected? |
269 movlw ambient_light_max_eco ; YES - select eco brightness | 269 movlw ambient_light_max_eco ; YES - select eco brightness |
270 dcfsnz isr_lo,F ; - level 1 (medium) selected? | 270 dcfsnz isr_lo,F ; - level 1 (medium) selected? |
305 | 305 |
306 movlw .254 | 306 movlw .254 |
307 movwf ambient_light+0 ; avoid ADC clipping | 307 movwf ambient_light+0 ; avoid ADC clipping |
308 | 308 |
309 get_ambient_level2: | 309 get_ambient_level2: |
310 movff opt_brightness,isr_lo ; get brightness setting | 310 movff brightness,isr_lo ; get brightness setting |
311 | 311 |
312 btfsc RCSTA1,7 ; UART module on? | 312 btfsc RCSTA1,7 ; UART module on? |
313 clrf isr_lo ; YES - set temporary to eco mode | 313 clrf isr_lo ; YES - set temporary to eco mode |
314 | 314 |
315 incf isr_lo,F ; adjust 0-2 to 1-3 | 315 incf isr_lo,F ; adjust 0-2 to 1-3 |
329 | 329 |
330 incf ambient_light+0,F ; +1 | 330 incf ambient_light+0,F ; +1 |
331 cpfslt ambient_light+0 ; smaller than WREG? | 331 cpfslt ambient_light+0 ; smaller than WREG? |
332 movwf ambient_light+0 ; NO - set to max. | 332 movwf ambient_light+0 ; NO - set to max. |
333 | 333 |
334 movff opt_brightness,isr_lo ; get brightness setting | 334 movff brightness,isr_lo ; get brightness setting |
335 incf isr_lo,F ; adjust 0-2 to 1-3 | 335 incf isr_lo,F ; adjust 0-2 to 1-3 |
336 movlw ambient_light_min_high ; default to highest setting | 336 movlw ambient_light_min_high ; default to highest setting |
337 dcfsnz isr_lo,F ; eco setting? | 337 dcfsnz isr_lo,F ; eco setting? |
338 movlw ambient_light_min_eco ; YES | 338 movlw ambient_light_min_eco ; YES |
339 dcfsnz isr_lo,F ; medium setting? | 339 dcfsnz isr_lo,F ; medium setting? |