diff --git a/boards/default_src/micropython/origin/build/lib/gnss.py b/boards/default_src/micropython/origin/build/lib/gnss.py index dd4786c3..a9395dc3 100644 --- a/boards/default_src/micropython/origin/build/lib/gnss.py +++ b/boards/default_src/micropython/origin/build/lib/gnss.py @@ -14,7 +14,7 @@ class NMEA0183: self._uart.init(baudrate=baudrate, timeout=timeout, rxbuf=1024) self.time=[None, None, None, None, None, None] self.locate=['', None, '', None, None, None, None] #0'1经度,2'3纬度,4海拔m,5速度m/s,6航向° - self.status=[False, ' ', 0] #有效标注,定位模式,卫星量 + self.status=[False, ' ', 0] #有效标注,定位模式,卫星量 if not self._chip_id(): raise AttributeError("Cannot find a GNSS device") @@ -29,11 +29,11 @@ class NMEA0183: for _ in range(10): sleep_ms(300) if self.any(): - self._uart.write(("$PCAS02,1000*2E\r\n").encode()) #更新频率1HZ + self._uart.write(("$PCAS02,1000*2E\r\n").encode()) #更新频率1HZ self._uart.write("$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0*02\r\n".encode()) #只加载GNGGA和GNRMC return True - def _judge(self, buffer, dlen): + def _judge(self, buffer, dlen): try: data=buffer.strip().decode().split(',') if len(data) == dlen: diff --git a/boards/default_src/micropython/origin/build/lib/sht20.py b/boards/default_src/micropython/origin/build/lib/sht20.py new file mode 100644 index 00000000..28a4ab89 --- /dev/null +++ b/boards/default_src/micropython/origin/build/lib/sht20.py @@ -0,0 +1,31 @@ +from struct import unpack as unp +from time import sleep_ms + +# SHT20 default address +SHT20_I2CADDR = 64 +TRI_T_MEASURE_NO_HOLD = b'\xf3' +TRI_RH_MEASURE_NO_HOLD = b'\xf5' +READ_USER_REG = b'\xe7' +WRITE_USER_REG = b'\xe6' +SOFT_RESET = b'\xfe' + +class SHT20(object): + def __init__(self, i2c_bus): + self._address = SHT20_I2CADDR + self._bus = i2c_bus + + def get_SHT_temperature(self): + self._bus.writeto(self._address, TRI_T_MEASURE_NO_HOLD) + sleep_ms(150) + origin_data = self._bus.readfrom(self._address, 2) + origin_value = unp('>h', origin_data)[0] + value = -46.85 + 175.72 * (origin_value / 65536) + return value + + def get_SHT_relative_humidity(self): + self._bus.writeto(self._address, TRI_RH_MEASURE_NO_HOLD) + sleep_ms(150) + origin_data = self._bus.readfrom(self._address, 2) + origin_value = unp('>H', origin_data)[0] + value = -6 + 125 * (origin_value / 65536) + return value diff --git a/boards/default_src/micropython_esp32/origin/build/Generic_ESP32_lib-v1.23.0.bin b/boards/default_src/micropython_esp32/origin/build/Generic_ESP32_lib-v1.23.0.bin index bd038077..b83bddc6 100644 Binary files a/boards/default_src/micropython_esp32/origin/build/Generic_ESP32_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32/origin/build/Generic_ESP32_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32/origin/build/Mixgo_PE_lib-v1.23.0.bin b/boards/default_src/micropython_esp32/origin/build/Mixgo_PE_lib-v1.23.0.bin index f86899a7..1965c92e 100644 Binary files a/boards/default_src/micropython_esp32/origin/build/Mixgo_PE_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32/origin/build/Mixgo_PE_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32/origin/build/Mixgo_lib-v1.23.0.bin b/boards/default_src/micropython_esp32/origin/build/Mixgo_lib-v1.23.0.bin index 77551949..39304525 100644 Binary files a/boards/default_src/micropython_esp32/origin/build/Mixgo_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32/origin/build/Mixgo_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32/origin/build/mPython_lib-v1.23.0.bin b/boards/default_src/micropython_esp32/origin/build/mPython_lib-v1.23.0.bin index 5dab64b5..11c187d7 100644 Binary files a/boards/default_src/micropython_esp32/origin/build/mPython_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32/origin/build/mPython_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib-v1.23.0.bin b/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib-v1.23.0.bin index 7ddf70df..df5d6775 100644 Binary files a/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib_ble-v1.23.0.bin b/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib_ble-v1.23.0.bin index 0c8188cd..ad08e770 100644 Binary files a/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib_ble-v1.23.0.bin and b/boards/default_src/micropython_esp32c2/origin/build/Mixgo_Mini_lib_ble-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32c3/origin/build/Generic_C3_UART_lib-v1.23.0.bin b/boards/default_src/micropython_esp32c3/origin/build/Generic_C3_UART_lib-v1.23.0.bin index bce31ddf..3f256a24 100644 Binary files a/boards/default_src/micropython_esp32c3/origin/build/Generic_C3_UART_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32c3/origin/build/Generic_C3_UART_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32c3/origin/build/Mixgo_CC_lib-v1.23.0.bin b/boards/default_src/micropython_esp32c3/origin/build/Mixgo_CC_lib-v1.23.0.bin index 57647300..eaf07177 100644 Binary files a/boards/default_src/micropython_esp32c3/origin/build/Mixgo_CC_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32c3/origin/build/Mixgo_CC_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32c3/origin/build/Mixgo_Car_lib-v1.23.0.bin b/boards/default_src/micropython_esp32c3/origin/build/Mixgo_Car_lib-v1.23.0.bin index 605da37f..9a8664c2 100644 Binary files a/boards/default_src/micropython_esp32c3/origin/build/Mixgo_Car_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32c3/origin/build/Mixgo_Car_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32c3/origin/build/Mixgo_ME_lib-v1.23.0.bin b/boards/default_src/micropython_esp32c3/origin/build/Mixgo_ME_lib-v1.23.0.bin index 8ca2f262..f57d6704 100644 Binary files a/boards/default_src/micropython_esp32c3/origin/build/Mixgo_ME_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32c3/origin/build/Mixgo_ME_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32s2/origin/build/Generic_S2_lib-v1.23.0.bin b/boards/default_src/micropython_esp32s2/origin/build/Generic_S2_lib-v1.23.0.bin index 979dcfe7..f169ae5f 100644 Binary files a/boards/default_src/micropython_esp32s2/origin/build/Generic_S2_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32s2/origin/build/Generic_S2_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_esp32s2/origin/build/Mixgo_CE_lib-v1.23.0.bin b/boards/default_src/micropython_esp32s2/origin/build/Mixgo_CE_lib-v1.23.0.bin index 9e249b7f..0e4d9a40 100644 Binary files a/boards/default_src/micropython_esp32s2/origin/build/Mixgo_CE_lib-v1.23.0.bin and b/boards/default_src/micropython_esp32s2/origin/build/Mixgo_CE_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_robot/origin/build/MixBot_lib-v1.23.0.bin b/boards/default_src/micropython_robot/origin/build/MixBot_lib-v1.23.0.bin index 3a2b0058..cf6fc85f 100644 Binary files a/boards/default_src/micropython_robot/origin/build/MixBot_lib-v1.23.0.bin and b/boards/default_src/micropython_robot/origin/build/MixBot_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_robot/origin/build/Mixgo_FeiYi_lib-v1.23.0.bin b/boards/default_src/micropython_robot/origin/build/Mixgo_FeiYi_lib-v1.23.0.bin index 62d984e1..26dfb194 100644 Binary files a/boards/default_src/micropython_robot/origin/build/Mixgo_FeiYi_lib-v1.23.0.bin and b/boards/default_src/micropython_robot/origin/build/Mixgo_FeiYi_lib-v1.23.0.bin differ diff --git a/boards/default_src/micropython_robot/origin/build/RM_E1_lib-v1.23.0.bin b/boards/default_src/micropython_robot/origin/build/RM_E1_lib-v1.23.0.bin index 35a39040..f5ff79ed 100644 Binary files a/boards/default_src/micropython_robot/origin/build/RM_E1_lib-v1.23.0.bin and b/boards/default_src/micropython_robot/origin/build/RM_E1_lib-v1.23.0.bin differ