comparison src/tft_outputs.asm @ 50:ec4d8503ec45

NEW: user-selectable color schemes
author heinrichsweikamp
date Fri, 27 Sep 2013 23:45:57 +0200
parents 7c7d7644ca37
children 0fae975af741
comparison
equal deleted inserted replaced
49:fe01bbaf6014 50:ec4d8503ec45
24 #include "divemode.inc" 24 #include "divemode.inc"
25 #include "external_flash.inc" 25 #include "external_flash.inc"
26 #include "ghostwriter.inc" 26 #include "ghostwriter.inc"
27 #include "customview.inc" 27 #include "customview.inc"
28 #include "i2c.inc" 28 #include "i2c.inc"
29 #include "colorschemes.inc"
29 30
30 extern aa_wordprocessor 31 extern aa_wordprocessor
31 32
32 ;============================================================================= 33 ;=============================================================================
33 34
34 gui CODE 35 gui CODE
35 ;============================================================================= 36 ;=============================================================================
36 37
37 global TFT_divemask_color 38 global TFT_divemask_color
38 TFT_divemask_color: 39 TFT_divemask_color:
39 movlw color_green ; TODO 40 movlw color_green
41 btfsc divemode ; in Divemode?
42 rcall TFT_divemask_color_dive
43 bra TFT_standard_color0
44
45 TFT_divemask_color_dive:
46 movff opt_dive_color_scheme,WREG ; 0-3
47 incf WREG
48 dcfsnz WREG
49 bra TFT_divemask_colordive0 ;0
50 dcfsnz WREG
51 bra TFT_divemask_colordive1 ;1
52 dcfsnz WREG
53 bra TFT_divemask_colordive2 ;2
54 dcfsnz WREG
55 bra TFT_divemask_colordive3 ;3
56 TFT_divemask_colordive0:
57 movlw color_scheme_divemode_mask1
58 return
59 TFT_divemask_colordive1:
60 movlw color_scheme_divemode_mask2
61 return
62 TFT_divemask_colordive2:
63 movlw color_scheme_divemode_mask3
64 return
65 TFT_divemask_colordive3:
66 movlw color_scheme_divemode_mask4
67 return
68
69
70 global TFT_attention_color
71 TFT_attention_color:
72 movlw color_yellow
40 bra TFT_standard_color0 73 bra TFT_standard_color0
41 74
42 global TFT_warnings_color 75 global TFT_warnings_color
43 TFT_warnings_color: 76 TFT_warnings_color:
44 movlw color_red ; TODO 77 movlw color_red ; TODO
49 movlw color_grey ; Default to OSTC grey (dark blue) 82 movlw color_grey ; Default to OSTC grey (dark blue)
50 bra TFT_standard_color0 83 bra TFT_standard_color0
51 84
52 global TFT_standard_color 85 global TFT_standard_color
53 TFT_standard_color: 86 TFT_standard_color:
54 setf WREG ; TODO... 87 setf WREG
88 btfsc divemode ; in Divemode?
89 rcall TFT_standard_color_dive
55 TFT_standard_color0: 90 TFT_standard_color0:
56 call TFT_set_color 91 call TFT_set_color
57 return 92 return
93 TFT_standard_color_dive:
94 movff opt_dive_color_scheme,WREG ; 0-3
95 incf WREG
96 dcfsnz WREG
97 bra TFT_standard_colordive0 ;0
98 dcfsnz WREG
99 bra TFT_standard_colordive1 ;1
100 dcfsnz WREG
101 bra TFT_standard_colordive2 ;2
102 dcfsnz WREG
103 bra TFT_standard_colordive3 ;3
104 TFT_standard_colordive0:
105 movlw color_scheme_divemode_std1
106 return
107 TFT_standard_colordive1:
108 movlw color_scheme_divemode_std2
109 return
110 TFT_standard_colordive2:
111 movlw color_scheme_divemode_std3
112 return
113 TFT_standard_colordive3:
114 movlw color_scheme_divemode_std4
115 return
58 116
59 TFT_color_code macro color_code_temp 117 TFT_color_code macro color_code_temp
60 movlw color_code_temp 118 movlw color_code_temp
61 call TFT_color_code1 119 call TFT_color_code1
62 endm 120 endm
248 bra TFT_color_code_warn ; No 306 bra TFT_color_code_warn ; No
249 call TFT_standard_color 307 call TFT_standard_color
250 return 308 return
251 309
252 ; **************************************************************************** 310 ; ****************************************************************************
311
312
313 global TFT_show_color_schemes
314 TFT_show_color_schemes: ; update the color schemes
315 bsf divemode ; put in divemode
316 call TFT_divemask_color
317 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row+.40
318 lfsr FSR2,buffer
319 STRCAT_TEXT_PRINT tDepth
320 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row+.40
321 lfsr FSR2,buffer
322 STRCAT_TEXT_PRINT tMaxDepth
323 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row+.40
324 lfsr FSR2,buffer
325 STRCAT_TEXT_PRINT tDivetime
326
327 ; Show some demo screen
328
329 ; Depth demo
330 call TFT_standard_color
331 lfsr FSR2,buffer
332 WIN_MEDIUM depth_column+.3,depth_row+.40
333 movlw LOW .5172
334 movwf lo
335 movlw HIGH .5172
336 movwf hi
337 bsf leftbind
338 bsf ignore_digit4
339 output_16 ; Full meters in Big font
340 bcf leftbind
341 STRCAT_PRINT "" ; Display full meters
342 WIN_SMALL depth_dm_column-.15,max_depth_dm_row+.40
343 movlw LOW .5172
344 movwf lo
345 movlw HIGH .5172
346 movwf hi
347 lfsr FSR2,buffer
348 PUTC "."
349 movlw d'4'
350 movwf ignore_digits
351 bsf ignore_digit5
352 output_16dp d'0' ; .1m in SMALL font
353 STRCAT_PRINT "" ; Display decimeters
354 WIN_FONT FT_SMALL
355
356 ; Max. Depth demo
357 WIN_MEDIUM max_depth_column,max_depth_row+.40
358 lfsr FSR2,buffer
359 bsf ignore_digit4 ; no 0.1m
360 bsf leftbind
361 movlw LOW .6349
362 movwf lo
363 movlw HIGH .6349
364 movwf hi
365 output_16
366 STRCAT_PRINT "" ; Display full meters
367 bcf leftbind
368 ; .1m in SMALL font
369 WIN_SMALL max_depth_dm_column,max_depth_dm_row+.40
370 lfsr FSR2,buffer
371 PUTC "."
372 movlw d'4'
373 movwf ignore_digits
374 bsf ignore_digit5
375 bsf leftbind
376 movlw LOW .6349
377 movwf lo
378 movlw HIGH .6349
379 movwf hi
380 output_16dp d'0'
381 STRCAT_PRINT "" ; Display decimeters
382 bcf leftbind
383
384 ; Divetime demo
385 movff mins,lo
386 clrf hi
387 WIN_MEDIUM divetime_column, divetime_row+.40
388 lfsr FSR2,buffer
389 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
390 STRCAT_PRINT "" ; Show minutes in large font
391 WIN_SMALL divetime_secs_column, divetime_secs_row+.40 ; left position for two sec figures
392 lfsr FSR2,buffer
393 PUTC ':'
394 bsf leftbind
395 movff secs,lo
396 output_99x
397 bcf leftbind
398 STRCAT_PRINT "" ; Show seconds in small font
399
400 bcf divemode ; don't stay in divemode
401 return
253 402
254 global TFT_divemode_mask 403 global TFT_divemode_mask
255 TFT_divemode_mask: ; Displays mask in Dive-Mode 404 TFT_divemode_mask: ; Displays mask in Dive-Mode
256 call TFT_divemask_color 405 call TFT_divemask_color
257 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row 406 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row
787 call TFT_standard_color 936 call TFT_standard_color
788 return 937 return
789 938
790 global TFT_menu_hud 939 global TFT_menu_hud
791 TFT_menu_hud: ; Yes, update HUD data 940 TFT_menu_hud: ; Yes, update HUD data
792 movlw color_yellow 941 call TFT_attention_color ; show in yellow
793 call TFT_set_color
794 bsf leftbind 942 bsf leftbind
795 WIN_SMALL surf_menu_sensor1_column,surf_menu_sensor1_row 943 WIN_SMALL surf_menu_sensor1_column,surf_menu_sensor1_row
796 lfsr FSR2,buffer 944 lfsr FSR2,buffer
797 movff o2_ppo2_sensor1,lo 945 movff o2_ppo2_sensor1,lo
798 clrf hi 946 clrf hi
1607 return ; Done. 1755 return ; Done.
1608 1756
1609 btg blinking_better_gas ; Toggle blink bit... 1757 btg blinking_better_gas ; Toggle blink bit...
1610 btfss blinking_better_gas ; blink now? 1758 btfss blinking_better_gas ; blink now?
1611 return ; No, Done. 1759 return ; No, Done.
1612 movlw color_yellow ; Blink in yellow 1760 call TFT_attention_color ; blink in yellow
1613 call TFT_set_color
1614 WIN_STD_INVERT active_gas_column,active_gas_row 1761 WIN_STD_INVERT active_gas_column,active_gas_row
1615 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1762 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1616 movff char_I_He_ratio,hi ; hi now stores He in % 1763 movff char_I_He_ratio,hi ; hi now stores He in %
1617 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) 1764 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
1618 WIN_INVERT .0 ; Init new Wordprocessor 1765 WIN_INVERT .0 ; Init new Wordprocessor
3005 3152
3006 ;============================================================================= 3153 ;=============================================================================
3007 ; Draw saturation graph, is surface mode or in dive mode. 3154 ; Draw saturation graph, is surface mode or in dive mode.
3008 DISP_tissue_saturation_graph: 3155 DISP_tissue_saturation_graph:
3009 ;---- Draw Frame 3156 ;---- Draw Frame
3010 WIN_FRAME_STD tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame 3157 call TFT_standard_color
3158 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame
3011 3159
3012 movlw .1 3160 movlw .1
3013 movff WREG,win_height ; row bottom (0-239) 3161 movff WREG,win_height ; row bottom (0-239)
3014 movlw tissue_diagram_left+.3 ; divemode 3162 movlw tissue_diagram_left+.3 ; divemode
3015 movff WREG,win_leftx2 ; column left (0-159) 3163 movff WREG,win_leftx2 ; column left (0-159)