Revision | 5b09efd1c1a9757b110a84bea4c82ca71d71a469 (tree) |
---|---|
Zeit | 2020-10-08 07:27:36 |
Autor | Satoshi Yasuda <7m3tjz@jarl...> |
Commiter | Satoshi Yasuda |
modified: debian/install
modified: debian/rules
modified: dmonitor.h
modified: dmonitor_cmd.c
modified: dmonitor_utils.c
modified: main.c
modified: node_utils.c
modified: rpt_conn.c
modified: rpt_conn.h
modified: rpt_conn_rig.c
@@ -21,8 +21,6 @@ Update /var/www/cgi-bin | ||
21 | 21 | Shutdown /var/www/cgi-bin |
22 | 22 | Reboot /var/www/cgi-bin |
23 | 23 | update_log /var/www/cgi-bin |
24 | -CallStore /var/www/cgi-bin | |
25 | -RegistCall /var/www/cgi-bin | |
26 | 24 | redirect /var/www/cgi-bin |
27 | 25 | simple_redirect /var/www/cgi-bin |
28 | 26 | init_cmd /var/www/cgi-bin |
@@ -54,8 +54,6 @@ override_dh_prep: | ||
54 | 54 | cp /var/www/cgi-bin/Shutdown debian/tmp/ |
55 | 55 | cp /var/www/cgi-bin/Reboot debian/tmp/ |
56 | 56 | cp /var/www/cgi-bin/update_log debian/tmp/ |
57 | - cp /var/www/cgi-bin/CallStore debian/tmp/ | |
58 | - cp /var/www/cgi-bin/RegistCall debian/tmp/ | |
59 | 57 | cp /var/www/cgi-bin/redirect debian/tmp/ |
60 | 58 | cp /var/www/cgi-bin/simple_redirect debian/tmp/ |
61 | 59 | cp /var/www/cgi-bin/init_cmd debian/tmp/ |
@@ -289,3 +289,4 @@ int scan_stop_sw; | ||
289 | 289 | |
290 | 290 | int lcd_type; |
291 | 291 | int lcd; |
292 | +time_t lcd_time_save; |
@@ -1,6 +1,19 @@ | ||
1 | 1 | #include "dmonitor.h" |
2 | 2 | |
3 | 3 | |
4 | +void lcd_write (void) | |
5 | +{ | |
6 | + if (lcd_type == LCD_20x4) | |
7 | + { | |
8 | + lcdPosition (lcd, 0, 3); | |
9 | + msg_temp [20] = 0x00; | |
10 | + lcdPuts (lcd, msg_temp); | |
11 | + } | |
12 | + else if (lcd_type == LCD_16x2) | |
13 | + { | |
14 | + } | |
15 | +} | |
16 | + | |
4 | 17 | int cmd_check (unsigned char cmd[]) |
5 | 18 | { |
6 | 19 |
@@ -9,73 +22,48 @@ int cmd_check (unsigned char cmd[]) | ||
9 | 22 | { |
10 | 23 | fprintf (status_fd, "%8.8s from Rig\n", cmd); |
11 | 24 | } |
12 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
13 | 25 | if (!memcmp (cmd, "DISCON", 6) || !memcmp (cmd, "UNLINK", 6)) |
14 | 26 | { |
15 | 27 | sprintf (msg_temp, "UNLINK FROM %8.8s", area_call); |
16 | 28 | memcpy (mycall2, "UNLK", 4); |
17 | 29 | send_msg_sw = TRUE; |
18 | 30 | sig_term = TRUE; |
19 | - if (lcd_type == LCD_20x4) | |
20 | - { | |
21 | - msg_temp[20] = 0x00; | |
22 | - lcdPuts (lcd, msg_temp); | |
23 | - } | |
31 | + lcd_write(); | |
24 | 32 | return FALSE; |
25 | 33 | } |
26 | 34 | if (!memcmp (cmd, "STATUS", 6)) |
27 | 35 | { |
28 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
29 | 36 | sprintf (msg_temp, "LINKED TO %8.8s ", area_call); |
30 | 37 | memcpy (mycall2, "DMON", 4); |
31 | 38 | send_msg_sw = TRUE; |
32 | - if (lcd_type == LCD_20x4) | |
33 | - { | |
34 | - msg_temp[20] = 0x00; | |
35 | - lcdPuts (lcd, msg_temp); | |
36 | - } | |
39 | + lcd_write (); | |
37 | 40 | return FALSE; |
38 | 41 | } |
39 | 42 | if (!memcmp (cmd, "SCAN", 4)) |
40 | 43 | { |
41 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
42 | 44 | memcpy (msg_temp, "EXIT FROM SCAN ", 20); |
43 | 45 | memcpy (mycall2, "DMON", 4); |
44 | 46 | send_msg_sw = TRUE; |
45 | 47 | scan_stop_sw = TRUE; |
46 | - if (lcd_type == LCD_20x4) | |
47 | - { | |
48 | - msg_temp[20] = 0x00; | |
49 | - lcdPuts (lcd, msg_temp); | |
50 | - } | |
48 | + lcd_write(); | |
51 | 49 | return FALSE; |
52 | 50 | } |
53 | 51 | if (!memcmp (cmd, "REBOOT", 6)) |
54 | 52 | { |
55 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
56 | 53 | memcpy (msg_temp, "RASPI REBOOT ", 20); |
57 | 54 | memcpy (mycall2, "DMON", 4); |
58 | 55 | send_msg_sw = ON; |
59 | 56 | reboot_sw = ON; |
60 | - if (lcd_type == LCD_20x4) | |
61 | - { | |
62 | - msg_temp[20] = 0x00; | |
63 | - lcdPuts (lcd, msg_temp); | |
64 | - } | |
57 | + lcd_write (); | |
65 | 58 | return FALSE; |
66 | 59 | } |
67 | 60 | if (!memcmp (cmd, "SHUTDOWN", 8)) |
68 | 61 | { |
69 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
70 | 62 | memcpy (msg_temp, "RASPI SHUTDOWN ", 20); |
71 | 63 | memcpy (mycall2, "DMON", 4); |
72 | 64 | send_msg_sw = ON; |
73 | 65 | shutdown_sw = ON; |
74 | - if (lcd_type == LCD_20x4) | |
75 | - { | |
76 | - msg_temp[20] = 0x00; | |
77 | - lcdPuts (lcd, msg_temp); | |
78 | - } | |
66 | + lcd_write(); | |
79 | 67 | return FALSE; |
80 | 68 | } |
81 | 69 | if (!memcmp (cmd, "CQCQCQ", 6)) |
@@ -12,6 +12,7 @@ void jitter_putFifo (void); | ||
12 | 12 | int send_dest_keep_alive(void); |
13 | 13 | int node_usb_init (void); |
14 | 14 | void node_close (void); |
15 | +void lcd_write(void); | |
15 | 16 | |
16 | 17 | extern char dummy_frame_1[12]; |
17 | 18 | extern char dummy_frame_2[12]; |
@@ -593,29 +594,19 @@ void error_msg (char str[]) | ||
593 | 594 | |
594 | 595 | if (!memcmp (&str[44], "未登録", 9)) |
595 | 596 | { |
596 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
597 | 597 | sprintf (msg_temp, "NOT REGIST %8.8s ", &str[31]); |
598 | 598 | memcpy (mycall2, "NORG", 4); |
599 | 599 | send_msg_sw = TRUE; |
600 | 600 | sig_term = TRUE; |
601 | 601 | not_clear_error_msg = TRUE; |
602 | - if (lcd_type == LCD_20x4) | |
603 | - { | |
604 | - msg_temp[20] = 0x00; | |
605 | - lcdPuts (lcd, msg_temp); | |
606 | - } | |
602 | + lcd_write(); | |
607 | 603 | } |
608 | 604 | if (!memcmp (&str[44], "登録済", 9)) |
609 | 605 | { |
610 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0,3); | |
611 | 606 | sprintf (msg_temp, "LINK TO %8.8s ", area_call); |
612 | 607 | memcpy (mycall2, "LINK", 4); |
613 | 608 | send_msg_sw = TRUE; |
614 | - if (lcd_type == LCD_20x4) | |
615 | - { | |
616 | - msg_temp[20] = 0x00; | |
617 | - lcdPuts (lcd, msg_temp); | |
618 | - } | |
609 | + lcd_write (); | |
619 | 610 | } |
620 | 611 | } |
621 | 612 |
@@ -87,6 +87,7 @@ int main(int argc, char *argv[]) | ||
87 | 87 | send_msg_sw = FALSE; |
88 | 88 | beep_sw = OFF; |
89 | 89 | scan_stop_sw = FALSE; |
90 | + lcd_time_save = 0; | |
90 | 91 | |
91 | 92 | openlog ("dmonitor", LOG_CONS | LOG_PID, LOG_LOCAL0); |
92 | 93 |
@@ -247,24 +248,24 @@ int main(int argc, char *argv[]) | ||
247 | 248 | pinMode(INET_LED, OUTPUT); |
248 | 249 | digitalWrite (RIG_LED, 0); |
249 | 250 | digitalWrite (INET_LED, 0); |
250 | - lcd_init(); | |
251 | 251 | inet_led_sw = 0; |
252 | 252 | rig_led_sw = 0; |
253 | 253 | if (lcd_type != NONE) |
254 | 254 | { |
255 | + lcd_init(); | |
255 | 256 | lcdPosition (lcd, 0, 0); |
256 | 257 | if (lcd_type == LCD_20x4) |
257 | 258 | { |
258 | 259 | |
259 | - if (scan_sw) sprintf (temp, "ScnRpt %8.8s scan", area_call); | |
260 | - else sprintf (temp, "Rpt %8.8s dmon", area_call); | |
261 | - temp[20] = 0x00; | |
260 | + if (scan_sw) sprintf (temp, "ScnRpt %8.8s ", area_call); | |
261 | + else sprintf (temp, "Rpt %8.8s ", area_call); | |
262 | + temp[16] = 0x00; | |
262 | 263 | } |
263 | 264 | else if (lcd_type == LCD_16x2) |
264 | 265 | { |
265 | - if (scan_sw) sprintf (temp, "%8.8s scan", area_call); | |
266 | - else sprintf (temp, "%8.8s dmon", area_call); | |
267 | - temp[16] = 0x00; | |
266 | + if (scan_sw) sprintf (temp, "%8.8s ", area_call); | |
267 | + else sprintf (temp, "%8.8s ", area_call); | |
268 | + temp[12] = 0x00; | |
268 | 269 | } |
269 | 270 | lcdPuts(lcd, temp); |
270 | 271 | } |
@@ -315,6 +316,25 @@ int main(int argc, char *argv[]) | ||
315 | 316 | while (1) |
316 | 317 | { |
317 | 318 | top: |
319 | + time (&cur_time); | |
320 | + if ((lcd_type != NONE) && (cur_time != lcd_time_save)) | |
321 | + { | |
322 | + if (lcd_type == LCD_20x4) lcdPosition (lcd, 16, 0); | |
323 | + else if (lcd_type == LCD_16x2) lcdPosition (lcd, 12, 0); | |
324 | + if (cur_time % 2) | |
325 | + { | |
326 | + if (scan_sw) lcdPuts (lcd, "SCAN\0"); | |
327 | + else lcdPuts (lcd, "DMON\0"); | |
328 | + } | |
329 | + else | |
330 | + { | |
331 | + if (scan_sw) lcdPuts (lcd, "scan\0"); | |
332 | + else lcdPuts (lcd, "dmon\0"); | |
333 | + } | |
334 | + lcd_time_save = cur_time; | |
335 | + } | |
336 | + | |
337 | + | |
318 | 338 | memcpy (&read_set, &fd_save, sizeof(fd_set)); |
319 | 339 | memcpy (&sigset, &save_sig, sizeof(save_sig)); |
320 | 340 | ret = pselect (FD_SETSIZE, &read_set, (fd_set *)NULL, |
@@ -339,7 +359,6 @@ top: | ||
339 | 359 | } |
340 | 360 | jitter_putFifo(); |
341 | 361 | rig (); |
342 | - time (&cur_time); | |
343 | 362 | if ((cur_time - hole_punch_send_time) >= hole_punch_send_interval) |
344 | 363 | { |
345 | 364 | if (hole_punch_send_interval == HOLE_PUNCH_SEND_INTERVAL) |
@@ -2,6 +2,8 @@ | ||
2 | 2 | |
3 | 3 | void PICinfo (void); |
4 | 4 | void node_term (void); |
5 | +void header_read_from_node(void); | |
6 | +int voice_read_from_node(void); | |
5 | 7 | |
6 | 8 | void node_close (void) |
7 | 9 | { |
@@ -21,6 +21,7 @@ int rpt_conn_scan (void); | ||
21 | 21 | void node_close (void); |
22 | 22 | void lcd_init (void); |
23 | 23 | void lcdPosition (int handle, int x, int y); |
24 | +void lcd_write (void); | |
24 | 25 | |
25 | 26 | void main(void) |
26 | 27 | { |
@@ -88,6 +89,7 @@ void main(void) | ||
88 | 89 | ScanTable_pnt = NULL; |
89 | 90 | wiringPiSetupGpio(); |
90 | 91 | if (lcd_type != NODE) lcd_init(); |
92 | + lcd_time_save = 0; | |
91 | 93 | loop: |
92 | 94 | node_VenderID = 0x4d8; |
93 | 95 | node_ProductID = 0x300; |
@@ -110,30 +112,21 @@ scan_loop: | ||
110 | 112 | while (1) |
111 | 113 | { |
112 | 114 | time (&cur_time); |
113 | - if (lcd_type == LCD_20x4) | |
115 | + if ((lcd_type != NONE) && (cur_time != lcd_time_save)) | |
114 | 116 | { |
115 | - lcdPosition (lcd, 16, 0); | |
116 | - } | |
117 | - else if (lcd_type == LCD_16x2) | |
118 | - { | |
119 | - lcdPosition (lcd, 12, 0); | |
120 | - } | |
121 | - if (lcd_type != NODE) | |
122 | - { | |
123 | - if (cur_time %2) memset (temp, 0x20, 4); | |
124 | - else | |
117 | + if (lcd_type == LCD_20x4) lcdPosition (lcd, 16, 0); | |
118 | + else if (lcd_type == LCD_16x2) lcdPosition (lcd, 12, 0); | |
119 | + if (cur_time %2) | |
125 | 120 | { |
126 | - if (scan_sw) | |
127 | - { | |
128 | - memcpy (temp, "scan", 4); | |
129 | - } | |
130 | - else | |
131 | - { | |
132 | - memcpy (temp, "rptc", 4); | |
133 | - } | |
134 | - } | |
135 | - temp[4] = 0x00; | |
136 | - lcdPuts (lcd, temp); | |
121 | + if (scan_sw) lcdPuts (lcd, "SCAN\0"); | |
122 | + else lcdPuts (lcd, "RPTC\0"); | |
123 | + } | |
124 | + else | |
125 | + { | |
126 | + if (scan_sw) lcdPuts (lcd, "scan\0"); | |
127 | + else lcdPuts (lcd, "rptc\0"); | |
128 | + } | |
129 | + lcd_time_save = cur_time; | |
137 | 130 | } |
138 | 131 | memcpy (&read_set, &fd_save, sizeof(fd_set)); |
139 | 132 | memcpy (&sigset, &save_sig, sizeof(save_sig)); |
@@ -193,63 +186,43 @@ skip: | ||
193 | 186 | } |
194 | 187 | if (!memcmp (connect_call, "STATUS", 6)) |
195 | 188 | { |
196 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
197 | 189 | memcpy (msg_temp, "RPT CONN RUNNING ", 20); |
198 | 190 | memcpy (mycall2, "RPTC", 4); |
199 | 191 | flag1 = 0x00; |
200 | 192 | send_msg_sw = TRUE; |
201 | 193 | memset (connect_call, 0x00, 8); |
202 | 194 | scan_sw = FALSE; |
203 | - if (lcd_type == LCD_20x4) | |
204 | - { | |
205 | - msg_temp[20] = 0x00; | |
206 | - lcdPuts (lcd, msg_temp); | |
207 | - } | |
195 | + lcd_write (); | |
208 | 196 | } |
209 | 197 | if (!memcmp (connect_call, "UNLINK", 6) || !memcmp (connect_call, "DISCON", 6)) |
210 | 198 | { |
211 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
212 | 199 | memcpy (msg_temp, "NOT UNLINK RPTC RUN", 20); |
213 | 200 | memcpy (mycall2, "RPTC", 4); |
214 | 201 | flag1 = 0x00; |
215 | 202 | send_msg_sw = TRUE; |
216 | 203 | memset (connect_call, 0x00, 8); |
217 | 204 | scan_sw = FALSE; |
218 | - if (lcd_type == LCD_20x4) | |
219 | - { | |
220 | - msg_temp[20] = 0x00; | |
221 | - lcdPuts (lcd, msg_temp); | |
222 | - } | |
205 | + lcd_write (); | |
223 | 206 | } |
224 | 207 | if (!memcmp (connect_call, "REBOOT", 6)) |
225 | 208 | { |
226 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
227 | 209 | memcpy (msg_temp, "RASPI REBOOT ", 20); |
228 | 210 | memcpy (mycall2, "RPTC", 4); |
229 | 211 | flag1 = 0x00; |
230 | 212 | send_msg_sw = TRUE; |
231 | 213 | memset (connect_call, 0x00, 8); |
232 | 214 | reboot_sw = TRUE; |
233 | - if (lcd_type == LCD_20x4) | |
234 | - { | |
235 | - msg_temp[20] = 0x00; | |
236 | - lcdPuts (lcd, msg_temp); | |
237 | - } | |
215 | + lcd_write (); | |
238 | 216 | } |
239 | 217 | if (!memcmp (connect_call, "SHUTDOWN", 6)) |
240 | 218 | { |
241 | - if (lcd_type == LCD_20x4) lcdPosition (lcd, 0, 3); | |
242 | 219 | memcpy (msg_temp, "RASPI SHUTDOWN ", 20); |
243 | 220 | memcpy (mycall2, "RPTC", 4); |
244 | 221 | flag1 = 0x00; |
245 | 222 | send_msg_sw = TRUE; |
246 | 223 | memset (connect_call, 0x00, 8); |
247 | 224 | shutdown_sw = TRUE; |
248 | - if (lcd_type == LCD_20x4) | |
249 | - { | |
250 | - msg_temp[20] = 0x00; | |
251 | - lcdPuts (lcd, msg_temp); | |
252 | - } | |
225 | + lcd_write (); | |
253 | 226 | } |
254 | 227 | if (!memcmp (connect_call, "SCAN", 4)) |
255 | 228 | { |
@@ -238,3 +238,4 @@ union | ||
238 | 238 | |
239 | 239 | int lcd_type; |
240 | 240 | int lcd; |
241 | +time_t lcd_time_save; |
@@ -15,7 +15,7 @@ void dvap_write (int fd, unsigned char buff[], int length); | ||
15 | 15 | int read_dvmega(void); |
16 | 16 | void send_dvmega_status(void); |
17 | 17 | void dvmega_write (int fd, unsigned char buff[], int length); |
18 | -void node_write (unsigned char buff[], int length); | |
18 | +void node_write (unsigned char buff[], int length); | |
19 | 19 | void dvmega (void); |
20 | 20 | void node (void); |
21 | 21 |