From 66b8220dcdb6c5925dde244479e19dc295954cca Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Wed, 19 Sep 2018 14:25:06 -0700 Subject: ubxtool: add get/set UBX-CFG-PMS --- contrib/ubxtool | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/ubxtool b/contrib/ubxtool index 6e27b10e..cc67c4c6 100755 --- a/contrib/ubxtool +++ b/contrib/ubxtool @@ -310,10 +310,25 @@ class ubx(object): (self.class_id_s(u[0], u[1]), u[2], u[3], u[4], u[5], u[6], u[7])) return s + def cfg_pms(self, buf): + "UBX-CFG-PMS decode, Power Mode Setup" + + m_len = len(buf) + if 0 == m_len: + return " Poll request" + + if 8 > m_len: + return "Bad Length %s" % m_len + + u = struct.unpack_from(' m_len: return "Bad Length %s" % m_len @@ -437,7 +453,10 @@ class ubx(object): 0x31: {'str': 'TP5', 'dec': cfg_tp5, 'name': 'UBX-CFG-TP5'}, 0x3d: {'str': 'TMODE2', 'dec': cfg_tmode2, 'name': 'UBX-CFG-TMODE2'}, - 0x3e: {'str': 'GNSS', 'dec': cfg_gnss, 'name': 'UBX-CFG-GNSS'}} + 0x3e: {'str': 'GNSS', 'dec': cfg_gnss, 'name': 'UBX-CFG-GNSS'}, + 0x86: {'str': 'PMS', 'dec': cfg_pms, + 'name': 'UBX-CFG-PMS'}, + } def inf_debug(self, buf): "UBX-INF-DEBUG decode" @@ -1677,6 +1696,19 @@ class ubx(object): m_data = bytearray(0) gps_model.gps_send(6, 0x24, m_data) + def send_cfg_pms(self): + "UBX-CFG-PMS, Get Power Management Settings" + + if opts["mode"] is not None: + m_data = bytearray(8) + # set powerSetupValue to mode + m_data[1] = opts["mode"] + # leave period and onTime zero, which breaks powerSetupValue = 3 + else: + m_data = bytearray(0) + + gps_model.gps_send(6, 0x86, m_data) + def send_cfg_prt(self): "UBX-CFG-PRT, get I/O Port" m_data = bytearray(0) @@ -1811,6 +1843,9 @@ class ubx(object): # UBX-CFG-NAV5, poll Nav Engine Settings "NAV5": {"command": send_cfg_nav5, "help": "UBX-CFG-NAV5 poll Nav Engines settings"}, + # UBX-CFG-PMS, poll power management settings + "PMS": {"command": send_cfg_pms, + "help": "UBX-CFG-PMS poll power management settings"}, # UBX-CFG-PRT, poll I/O port number "PRT": {"command": send_cfg_prt, "help": "UBX-CFG-PRT poll I/O port settings"}, -- cgit v1.2.1