mirror of
https://gitee.com/qpy-solutions/tracker-v2.git
synced 2025-05-19 02:58:25 +08:00
update: location check
This commit is contained in:
parent
5dca1ab0f3
commit
d01ffbd021
@ -12,7 +12,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import utime
|
||||
import checkNet
|
||||
|
||||
from usr.modules.sensor import Sensor
|
||||
@ -57,35 +56,22 @@ class DeviceCheck(object):
|
||||
raise TypeError("self.__locator is not registered")
|
||||
|
||||
current_settings = settings.get()
|
||||
retry = 0
|
||||
gps_data = None
|
||||
sleep_time = 1
|
||||
|
||||
while retry < 5:
|
||||
if retry > 0:
|
||||
retry += 1
|
||||
utime.sleep(sleep_time)
|
||||
sleep_time *= 2
|
||||
if current_settings["user_cfg"].get("loc_method"):
|
||||
loc_method = current_settings["user_cfg"].get("loc_method")
|
||||
elif current_settings["sys"]["base_cfg"]["LocConfig"]:
|
||||
loc_method = current_settings["LocConfig"].get("loc_method")
|
||||
else:
|
||||
loc_method = 7
|
||||
|
||||
if current_settings["user_cfg"].get("loc_method"):
|
||||
loc_method = current_settings["user_cfg"].get("loc_method")
|
||||
elif current_settings["sys"]["base_cfg"]["LocConfig"]:
|
||||
loc_method = current_settings["LocConfig"].get("loc_method")
|
||||
else:
|
||||
loc_method = 7
|
||||
|
||||
loc_info = self.__locator.read(loc_method)
|
||||
for k, v in loc_info.items():
|
||||
gps_data = v
|
||||
if gps_data:
|
||||
break
|
||||
loc_info = self.__locator.read(loc_method)
|
||||
for k, v in loc_info.items():
|
||||
gps_data = v
|
||||
if gps_data:
|
||||
break
|
||||
|
||||
if gps_data:
|
||||
return True
|
||||
|
||||
return False
|
||||
return True if gps_data else False
|
||||
|
||||
def temp(self):
|
||||
# return True if OK
|
||||
|
Loading…
x
Reference in New Issue
Block a user