comparison src/surfmode.asm @ 113:f3062a611eef

Merge
author heinrichsweikamp
date Mon, 23 Jun 2014 16:14:33 +0200
parents a5ea132770db
children 939f1e83c4c2
comparison
equal deleted inserted replaced
112:a24581f0b372 113:f3062a611eef
25 #include "divemode.inc" 25 #include "divemode.inc"
26 #include "mcp.inc" ; RX 26 #include "mcp.inc" ; RX
27 #include "i2c.inc" 27 #include "i2c.inc"
28 #include "comm.inc" 28 #include "comm.inc"
29 #include "eeprom_rs232.inc" 29 #include "eeprom_rs232.inc"
30 #include "calibrate.inc"
30 31
31 #DEFINE menu_pos_row .215 32 #DEFINE menu_pos_row .215
32 #DEFINE menu_pos_column .0 33 #DEFINE menu_pos_column .0
33 #DEFINE view_row .215 34 #DEFINE view_row .215
34 #DEFINE view_column .124 35 #DEFINE view_column .124
41 ;============================================================================= 42 ;=============================================================================
42 ; Boot tasks for all modes 43 ; Boot tasks for all modes
43 global surfloop 44 global surfloop
44 surfloop: 45 surfloop:
45 call speed_normal 46 call speed_normal
47 btfss c3_hardware
48 call piezo_config ; Configure buttons
46 bcf no_sensor_int ; Normal pressure mode 49 bcf no_sensor_int ; Normal pressure mode
47 50
48 clrf CCP1CON ; stop PWM 51 clrf CCP1CON ; stop PWM
49 bcf PORTC,2 ; Pull PWM output to GND 52 bcf PORTC,2 ; Pull PWM output to GND
50 call TFT_boot ; Initialize TFT (includes clear screen) 53 call TFT_boot ; Initialize TFT (includes clear screen)
172 movlb b'00000001' ; select ram bank 1 175 movlb b'00000001' ; select ram bank 1
173 176
174 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) 177 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
175 call enable_rs232 ; Also sets to speed_normal ... 178 call enable_rs232 ; Also sets to speed_normal ...
176 179
180 ; call disable_ir
181 ; bsf mcp_power
182 ; btfss mcp_power
183 ; bra $-4
184
177 surfloop_loop: 185 surfloop_loop:
178 btfss onesecupdate ; do every second tasks? 186 btfss onesecupdate ; do every second tasks?
179 bra surfloop_loop2 ; no, loop 187 bra surfloop_loop2 ; no, loop
180 188
181 ; One Second tasks for all modes 189 ; One Second tasks for all modes
182 call speed_normal 190 call speed_normal
183 call TFT_debug_output 191 call TFT_debug_output
184 call TFT_clock ; update clock 192 call TFT_clock ; update clock
185 call timeout_surfmode ; check timeout 193 call timeout_surfmode ; check timeout
186 call get_battery_voltage ; get battery voltage 194 call get_battery_voltage ; get battery voltage
195 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays
187 call TFT_update_batt_voltage ; display battery voltage 196 call TFT_update_batt_voltage ; display battery voltage
188 call set_dive_modes ; tests if depth>threshold 197 call set_dive_modes ; tests if depth>threshold
189 btfss secs,0 ; Every two seconds... 198 btfss secs,0 ; Every two seconds...
190 call TFT_temp_surfmode ; Displays temperature 199 call TFT_temp_surfmode ; Displays temperature
191 btfss secs,0 ; Every two seconds... 200 btfss secs,0 ; Every two seconds...
226 call surf_customview_toggle ; Yes, show next customview (and delete this flag) 235 call surf_customview_toggle ; Yes, show next customview (and delete this flag)
227 236
228 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) 237 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
229 bra surfloop_loop3 238 bra surfloop_loop3
230 btfsc vusb_in ; USB plugged in? 239 btfsc vusb_in ; USB plugged in?
231 goto comm_mode ; Start COMM mode 240 call comm_mode ; Start COMM mode
232 bra surfloop_loop4 241 bra surfloop_loop4
233 surfloop_loop3: 242 surfloop_loop3:
234 btfss vusb_in ; USB (still) plugged in? 243 btfss vusb_in ; USB (still) plugged in?
235 bcf enable_screen_dumps ; No, clear flag 244 bcf enable_screen_dumps ; No, clear flag
236 call rs232_get_byte 245 call rs232_get_byte