37 lines
709 B
Python
37 lines
709 B
Python
import queue
|
|
import re
|
|
|
|
gun_list = {}
|
|
|
|
g_std_com_port = None
|
|
|
|
g_xbee_mode = ""
|
|
|
|
admin_mode = False
|
|
count_interval = 10
|
|
|
|
message_queue = queue.Queue()
|
|
message_dequeue = ""
|
|
|
|
|
|
def only_hex_in_string(test):
|
|
return re.fullmatch(r"\b[0-9a-fA-F]+\b", test) is not None
|
|
|
|
|
|
def minutes_to_string(mins):
|
|
r_str = ""
|
|
if mins >= 525600:
|
|
tmp = int(mins // 525600)
|
|
r_str += "{}y ".format(tmp)
|
|
mins -= tmp * 525600
|
|
if mins >= 1440:
|
|
tmp = int(mins // 1440)
|
|
r_str += "{}d ".format(tmp)
|
|
mins -= tmp * 1440
|
|
if mins >= 60:
|
|
tmp = int(mins // 60)
|
|
r_str += "{}h ".format(tmp)
|
|
mins -= tmp * 60
|
|
r_str += "{}m".format(mins)
|
|
return r_str
|