Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hishizuka committed Jan 17, 2024
1 parent b5ca4ee commit 6c04b55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/helper/maptile.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ def get_headwind(wind_speed, wind_track, track):
return np.nan
if wind_speed == 0:
return 0
rad_diff = math.radians(wind_track-track)
# plus: headwind, minus: tailwind
return round(math.cos(math.radians(wind_track-track)) * wind_speed, 1)

return round(math.cos(rad_diff) * wind_speed, 1)
# abs(round(math.sin(rad_diff) * wind_speed, 1)) # crosswind

def conv_image(image, map_name):
res = None
Expand Down Expand Up @@ -542,6 +543,7 @@ async def update_jpn_scw_timeline(self, map_settings, update_basetime):
self.get_scw_lock = True
f_name = self.update_jpn_scw_timeline.__name__
if not await self.config.network.open_bt_tethering(f_name):
self.get_scw_lock = False
return

# app_logger.info("get_scw_list connection start...")
Expand Down
7 changes: 7 additions & 0 deletions modules/helper/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ async def open_bt_tethering(self, f_name):

if not self.config.G_AUTO_BT_TETHERING:
return True
elif self.config.G_AUTO_BT_TETHERING and not self.config.G_BT_USE_ADDRESS:
return False

if detect_network():
if bool(self.bt_tethering_status):
Expand Down Expand Up @@ -316,6 +318,11 @@ async def close_bt_tethering(self, f_name):

if not self.config.G_AUTO_BT_TETHERING:
return True
elif self.config.G_AUTO_BT_TETHERING and not self.config.G_BT_USE_ADDRESS:
return True

# if BT tethering is ON
# return True

self.bt_tethering_status[f_name] = False
if (
Expand Down
1 change: 1 addition & 0 deletions modules/pyqt/menu/pyqt_system_menu_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def __init__(self, parent, page_name, config):
super().__init__(parent=parent, page_name=page_name, config=config)

def preprocess(self, run_bt_tethering=True):
super().preprocess()
self.run_bt_tethering = run_bt_tethering

def get_default_value(self):
Expand Down

0 comments on commit 6c04b55

Please sign in to comment.