Skip to content

Commit

Permalink
Bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Mar 4, 2024
1 parent 4bd6041 commit 33b3985
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions leads_raspberry_pi/gps_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, port: str, baud_rate: int = 9600) -> None:
self._connection: _SerialConnection | None = None
self._latitude: float = 0
self._longitude: float = 0
self._fixed: bool = False
self._fixed: bool = True

@_override
def port(self) -> str:
Expand All @@ -55,7 +55,11 @@ def update(self, data: _TalkerSentence) -> None:
self._latitude = float(data.latitude)
self._longitude = float(data.longitude)
elif isinstance(data, _GSA):
self._fixed = data.is_valid
if (v := data.is_valid) and not self._fixed:
_SFT.recover(self)
elif not v and self._fixed:
_SFT.fail(self, "GPS not fixed")
self._fixed = v

@_override
def read(self) -> [bool, float, float]:
Expand Down

0 comments on commit 33b3985

Please sign in to comment.