comparison src/testmode.asm @ 67:7815bf21d353

second debug mode page
author heinrichsweikamp
date Sat, 11 Jan 2014 22:36:17 +0100
parents ec4d8503ec45
children 3274e87fd027
comparison
equal deleted inserted replaced
66:00636132cca6 67:7815bf21d353
22 #include "mcp.inc" ; RX 22 #include "mcp.inc" ; RX
23 #include "i2c.inc" 23 #include "i2c.inc"
24 #include "surfmode.inc" 24 #include "surfmode.inc"
25 #include "math.inc" 25 #include "math.inc"
26 #include "eeprom_rs232.inc" 26 #include "eeprom_rs232.inc"
27 #include "ms5541.inc"
27 28
28 extern compass 29 extern compass
29 extern compass_filter 30 extern compass_filter
30 extern compass_filter_init 31 extern compass_filter_init
31 extern compass_reset_calibration 32 extern compass_reset_calibration
35 testmode CODE 36 testmode CODE
36 37
37 ;============================================================================= 38 ;=============================================================================
38 ; Boot tasks for all modes 39 ; Boot tasks for all modes
39 global testloop 40 global testloop
40 testloop: 41 testloop: ; Page1
41 call speed_normal 42 call speed_normal
42 bcf no_sensor_int ; Sensor ISR 43 bcf no_sensor_int ; Sensor ISR
43 44
44 clrf CCP1CON ; stop PWM 45 clrf CCP1CON ; stop PWM
45 bcf PORTC,2 ; Pull PWM output to GND 46 bcf PORTC,2 ; Pull PWM output to GND
99 bsf LEDg 100 bsf LEDg
100 101
101 ; Mode tasks 102 ; Mode tasks
102 extern surfloop 103 extern surfloop
103 btfsc switch_left 104 btfsc switch_left
104 goto surfloop ; Exit 105 bra testloop2 ; Page 2
105 106
106 btfsc switch_right 107 btfsc switch_right
107 goto compass_calibration_loop 108 goto compass_calibration_loop
108 109
109 btfsc sleepmode ; Sleepmode active? 110 btfsc sleepmode ; Sleepmode active?
111 bra testloop2 ; Page 2
112
113 bra testloop_loop ; loop testmode
114
115 testloop2: ; Page2
116 call speed_normal
117 bsf no_sensor_int ; disable sensor interrupt
118 call get_calibration_data ; Get calibration data from pressure sensor
119 banksel common ; get_calibration_data uses isr_backup
120 bcf no_sensor_int ; normal sensor interrupt mode
121
122 clrf CCP1CON ; stop PWM
123 bcf PORTC,2 ; Pull PWM output to GND
124 call TFT_boot ; Initialize TFT (includes clear screen)
125 WIN_TOP .0
126 WIN_LEFT .0
127 WIN_FONT FT_SMALL
128 WIN_INVERT .0 ; Init new Wordprocessor
129 call TFT_standard_color
130 call TFT_Display_FadeIn
131
132 clrf timeout_counter2
133 clrf timeout_counter3
134 bcf premenu ; clear premenu flag
135 bcf menubit ; clear menu flag
136
137 bcf switch_left
138 bcf switch_right
139
140 testloop2_loop:
141 btfss onesecupdate ; do every second tasks?
142 bra testloop2_loop2 ; no, loop
143
144 ; One Second tasks
145 call TFT_update_raw_data2
146 movlw .240
147 call timeout_testmode ; check timeout
148
149 bcf onesecupdate ; every second tasks done
150
151 testloop2_loop2:
152 ; Tasks approx. every 50ms for all modes
153 bcf LEDg
154 btfsc vusb_in
155 bsf LEDg
156
157 ; Mode tasks
158 btfsc switch_left
159 goto surfloop ; Exit
160
161 btfsc sleepmode ; Sleepmode active?
110 goto sleeploop ; Yes, switch into sleepmode! 162 goto sleeploop ; Yes, switch into sleepmode!
111 163
112 bra testloop_loop ; loop testmode 164 bra testloop2_loop ; loop testmode
113 165
114 166
115 global compass_calibration_loop 167 global compass_calibration_loop
116 compass_calibration_loop: ; Compass calibration 168 compass_calibration_loop: ; Compass calibration
117 bsf no_sensor_int ; No Sensor ISR 169 bsf no_sensor_int ; No Sensor ISR