Skip to content

Commit 9742a4d

Browse files
committed
updates Alarm Panel Pro network check to more aggressive test
1 parent f6be4b0 commit 9742a4d

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,31 @@ cp config.yaml.example config.yaml
6060

6161
Now edit the `config.yaml` with your settings and preferences. Here's an example:
6262
```yaml
63+
flash: true
64+
network_check: true
6365
label_printer:
6466
enabled: true
6567
type: pdf
6668
name: Brother_QL_810W
6769
ip: 192.168.1.33
70+
serial_port_pattern: /dev/cu.usbserial*
6871
```
6972
73+
#### flash
74+
Set to `true` to flash the firmware, otherwise firmware will not be modified.
75+
76+
#### network_check
77+
Set to `true` to run the Alarm Panel Pro network check.
78+
7079
#### label_printer
7180
* *enabled* - `true` to enable label printing
7281
* *type* - `zpl` if using a Zebra printer, otherwise `pdf`
7382
* *name* - The CUPS name of the printer (use `lpstat -a`)
7483
* *ip* - The IP address of the printer (only needed when using Zebra printers)
7584

85+
#### serial_port_pattern
86+
A file path pattern to scan for devices connected via USB/UART ports.
87+
7688
## Running
7789
Run the program by executing it in Ruby:
7890
```shell

config.yaml.example

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
serial_port_pattern: /dev/cu.usbserial*
1+
flash: true
2+
network_check: true
23
label_printer:
34
enabled: true
45
type: pdf
56
name: Brother_QL_810W
6-
ip: 192.168.1.33
7+
ip: 192.168.1.33
8+
serial_port_pattern: /dev/cu.usbserial*

lib/gdo_preflight.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def self.firmwares
66
end
77

88
def start
9-
flash_firmware
9+
flash_firmware if @runner.config.flash
1010
if @runner.config.label_printer[:enabled]
1111
generate_label
1212
print_label

lib/pro_preflight.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ def self.firmwares
3434
end
3535

3636
def start
37-
flash_firmware
38-
erase_lfs_region
39-
# get_device_id
40-
return unless network_check
37+
if @runner.config.flash
38+
flash_firmware
39+
erase_lfs_region
40+
else
41+
get_device_id
42+
end
43+
if @runner.config.network_check
44+
return unless network_check
45+
end
4146
if @runner.config.label_printer[:enabled]
4247
generate_label
4348
print_label
@@ -122,7 +127,7 @@ def generate_label
122127
private
123128

124129
def ping_test(ip)
125-
ping = `ping #{ip} -i 0.5 -c 15 -q`
130+
ping = `ping #{ip} -g 56 -G 1500 -h 64 -i 0.5 -q`
126131
packet_loss = ping.match(/(\d+\.\d+)% packet loss/)[1].to_i
127132
return packet_loss
128133
end

0 commit comments

Comments
 (0)