Commit 8cc454f9 by Oleksandr Barabash

hotfixes on the project

parent fe086c42
...@@ -55,7 +55,7 @@ d = 40000 # draw distance of LOBs in meters ...@@ -55,7 +55,7 @@ d = 40000 # draw distance of LOBs in meters
heading_d = 20000 heading_d = 20000
max_age = 5000 max_age = 5000
receivers = [] receivers = []
cached_receivers = []
############################################### ###############################################
# Stores settings realted to intersect capture # Stores settings realted to intersect capture
...@@ -633,7 +633,11 @@ def write_czml(best_point, all_the_points, ellipsedata, plotallintersects, eps): ...@@ -633,7 +633,11 @@ def write_czml(best_point, all_the_points, ellipsedata, plotallintersects, eps):
@get('/receivers.czml') @get('/receivers.czml')
def write_rx_czml(): def write_rx_czml():
response.set_header( response.set_header(
'Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0') 'Cache-Control', 'no-cache, no-store, must-revalidate, max-age=0',
)
response.set_header(
'Content-Type', 'application/json'
)
height = 50 height = 50
min_conf = ms.min_conf min_conf = ms.min_conf
min_power = ms.min_power min_power = ms.min_power
...@@ -713,8 +717,13 @@ def write_rx_czml(): ...@@ -713,8 +717,13 @@ def write_rx_czml():
**rx_properties, **rx_icon}, **rx_properties, **rx_icon},
position={"cartographicDegrees": [x.longitude, x.latitude, 15]})) position={"cartographicDegrees": [x.longitude, x.latitude, 15]}))
return Document([top] + receiver_point_packets + lob_packets).dumps(separators=(',', ':')) response_data = Document([top] + receiver_point_packets + lob_packets).dumps(separators=(',', ':'))
# 11.01.2023::s1z: I know this is ugly and stupid,
# but we're not gonna rewrite the project anyways,
# so, whatever...
globals()["cached_receivers"] = response_data
return response_data
return globals()["cached_receivers"]
############################################### ###############################################
# Writes aoi.czml used by the WebUI # Writes aoi.czml used by the WebUI
...@@ -1022,6 +1031,7 @@ def run_receiver(receivers): ...@@ -1022,6 +1031,7 @@ def run_receiver(receivers):
except IOError: except IOError:
print("Problem connecting to receiver.") print("Problem connecting to receiver.")
rx.d_2_last_intersection = [] rx.d_2_last_intersection = []
time.sleep(0.1)
for x in range(len(receivers)): for x in range(len(receivers)):
for y in range(x): for y in range(x):
...@@ -1048,6 +1058,16 @@ def run_receiver(receivers): ...@@ -1048,6 +1058,16 @@ def run_receiver(receivers):
if intersection.any() is not None: if intersection.any() is not None:
intersect_list = np.concatenate( intersect_list = np.concatenate(
(intersect_list, intersection), axis=0) (intersect_list, intersection), axis=0)
# 11.01.2023::s1z: I don't know if this shit-code is blocking
# or not. But if it is, you better fucking sleep
# 10ms after each cycle to prevent 100% load
# of the CPU.
time.sleep(0.1)
# 11.01.2023::s1z: I don't know if this shit-code is blocking
# or not. But if it is, you better fucking sleep
# 10ms after each cycle to prevent 100% load
# of the CPU.
time.sleep(0.1)
if intersect_list.size != 0: if intersect_list.size != 0:
avg_coord = np.average( avg_coord = np.average(
...@@ -1113,6 +1133,11 @@ def run_receiver(receivers): ...@@ -1113,6 +1133,11 @@ def run_receiver(receivers):
command = "INSERT INTO lobs VALUES (?,?,?,?,?,?)" command = "INSERT INTO lobs VALUES (?,?,?,?,?,?)"
DATABASE_EDIT_Q.put((command, [current_doa, ], True)) DATABASE_EDIT_Q.put((command, [current_doa, ], True))
DATABASE_RETURN.get(timeout=1) DATABASE_RETURN.get(timeout=1)
# 11.01.2023::s1z: I don't know if this shit-code is blocking
# or not. But if it is, you better fucking sleep
# 10ms after each cycle to prevent 100% load
# of the CPU.
time.sleep(0.01) # 11.01.2023::s1z: The fuck is this crap ?
DATABASE_EDIT_Q.put(("done", None, False)) DATABASE_EDIT_Q.put(("done", None, False))
# try: # try:
...@@ -1432,7 +1457,10 @@ if __name__ == '__main__': ...@@ -1432,7 +1457,10 @@ if __name__ == '__main__':
clear(debugging) clear(debugging)
if not debugging: if not debugging:
print("Receiver Paused") print("Receiver Paused")
time.sleep(1) # 11.01.2023::s1z: I don't know wtf is this crap, but sleep 1 sec,
# You gotta be kidding me.
# Changed fro 1 sec to 10 ms.
time.sleep(0.01)
except KeyboardInterrupt: except KeyboardInterrupt:
finish() finish()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment