11(def firts_iteration_remote 0 )
22(def remote_screen_num 0 )
3+ (def remote_screen_count 3 )
4+ (def thum_stick_prescaler 0 )
35(def distance_total 0.0 )
6+
47@const-start
58(defun remote_screen (){
69 (if (= firts_iteration_remote 0 ){
710 (disp-clear)
811 (def text_box (img-buffer ' indexed2 128 14 ))
9- (txt-block-l text_box 1 0 0 font_9x14 " EXIT NEXT" )
10- (disp-render text_box (+ x_offset 0 ) (+ y_offset 53 ) ' (0 0xFFFFFF))
11- (img-clear text_box)
1212 (def text_box_2 (img-buffer ' indexed2 40 14 ))
1313 (def numb_box (img-buffer ' indexed2 120 30 ))
1414 (setq firts_iteration_remote 1 )
15-
1615 })
17-
16+
17+ (if (= remote_screen_num 2 )
18+ (txt-block-l text_box 1 0 0 font_9x14 " EXIT EDIT" )
19+ (txt-block-l text_box 1 0 0 font_9x14 " EXIT " )
20+ )
21+ (disp-render text_box (+ x_offset 0 ) (+ y_offset 53 ) ' (0 0xFFFFFF))
22+ (img-clear text_box)
23+
1824 (cond
1925 ((eq remote_screen_num 0 ) (progn
2026 (txt-block-l text_box 1 0 0 font_9x14 " MAC address" )
6369 (txt-block-l text_box 1 0 0 font_9x14 " Units" )
6470 (disp-render text_box (+ x_offset 1 ) (+ y_offset -1 ) ' (0 0xFFFFFF))
6571 (img-clear text_box)
66-
67- (if (= UNITS 1 )
72+
73+ (if (= units 1 )
6874 (txt-block-c numb_box 1 60 0 font_20x30 " METRIC" );
6975 (txt-block-c numb_box 1 60 0 font_20x30 " IMPERIAL" );
7076 )
71-
77+
7278 (disp-render numb_box (+ x_offset 4 ) (+ y_offset 17 ) ' (0 0xFFFFFF))
7379 (img-clear numb_box)
7480
8288 (img-clear text_box)
8389 (setq distance_total (to-float (eeprom-read-f total_trip_add)))
8490 (setq distance_total (+ distance_total (if (= distance 0 ) 0 (/ distance 1000 ))))
85- (if (= UNITS 1 )
86- {
91+ (if (= units 1 )
92+ {
8793 (txt-block-c numb_box 1 60 0 font_20x30 (str-from-n distance_total " %0.1f" ));
8894 (txt-block-c text_box_2 1 20 0 font_9x14 " Km" )
89- (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 44 ) ' (0 0xFFFFFF))
95+ (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 42 ) ' (0 0xFFFFFF))
9096 (img-clear text_box_2)
9197 }
9298 {
9399 (setq distance_total (* distance_total 0.6213 ))
94100 (txt-block-c numb_box 1 60 0 font_20x30 (str-from-n distance_total " %0.1f" ));
95101 (txt-block-c text_box_2 1 20 0 font_9x14 " Mil" )
96- (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 44 ) ' (0 0xFFFFFF))
102+ (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 42 ) ' (0 0xFFFFFF))
97103 (img-clear text_box_2)
98104 })
99105
100- (disp-render numb_box (+ x_offset 4 ) (+ y_offset 17 ) ' (0 0xFFFFFF))
101- (img-clear numb_box)
102-
106+ (disp-render numb_box (+ x_offset 4 ) (+ y_offset 14 ) ' (0 0xFFFFFF))
107+ (img-clear numb_box)
108+
103109 ))
104110 )
105-
111+
112+ ; cycle through screens
113+ (setq thum_stick_prescaler (+ thum_stick_prescaler 1 ))
114+ (if (and (> thum_stick_prescaler 10 )){
115+ (if (< (get-adc 0 ) 0.8 ){
116+ (setq remote_screen_num (+ remote_screen_num 1 ))
117+ (if (> remote_screen_num remote_screen_count) {
118+ (setq remote_screen_num 0 )
119+ })
120+ (disp-render numb_box (+ x_offset 4 ) (+ y_offset 17 ) ' (0 0xFFFFFF)); needed to clear the pixels
121+ (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 44 ) ' (0 0xFFFFFF)); needed to clear the pixels
122+ })
123+
124+ (if (> (get-adc 0 ) 2 ){
125+ (setq remote_screen_num (- remote_screen_num 1 ))
126+ (if (< remote_screen_num 0 ) {
127+ (setq remote_screen_num remote_screen_count)
128+ })
129+ (disp-render numb_box (+ x_offset 4 ) (+ y_offset 17 ) ' (0 0xFFFFFF)); needed to clear the pixels
130+ (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 44 ) ' (0 0xFFFFFF)); needed to clear the pixels
131+ })
132+ (setq thum_stick_prescaler 0 )
133+ })
134+
135+ ; update
106136 (if (= cfg_pressed_short 1 ){
107137 (setq cfg_pressed_short 0 )
108- (setq remote_screen_num (+ remote_screen_num 1 ))
109- (disp-render numb_box (+ x_offset 4 ) (+ y_offset 17 ) ' (0 0xFFFFFF)); needed to clear the pixels
110- (disp-render text_box_2 (+ x_offset 47 ) (+ y_offset 44 ) ' (0 0xFFFFFF)); needed to clear the pixels
111- (if (> remote_screen_num 3 )
112- (setq remote_screen_num 0 )
138+ ; update units
139+ (if (= remote_screen_num 2 )
140+ (if (= units 0 ) (setq units 1 ) (setq units 0 ))
113141 )
114- })
115-
142+ (eeprom-store-i units_add units)
143+ })
144+
145+ ; exit
116146 (if (= on_pressed_short 1 ){
117- (setq on_pressed_short 0 )
147+ (setq on_pressed_short 0 )
118148 (disp-clear)
119149 (setq firts_iteration 0 )
120150 (setq menu_sub_index 0 )
121151 (setq enter_menu 0 )
122152 (setq firts_iteration_remote 0 )
123- (setq remote_screen_num 0 )
124- })
153+ (setq remote_screen_num 0 )
154+ })
125155})
126156@const-start
0 commit comments