diff --git a/changelog.md b/changelog.md index cce48a4..f9395d8 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,10 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" --> ## Released +## [0.15.1] - 2023-05-13 +### Fixed +- Logger import fixed, see #31 + ## [0.15.0] - 2023-05-13 ### Added - `package.json` for `mip` installation with MicroPython v1.19.1 or newer, see #27 @@ -215,8 +219,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" - [Example HMI file](examples/everything.HMI) to be used for all examples -[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.15.0...develop +[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.15.1...develop +[0.15.1]: https://github.com/brainelectronics/micropython-nextion/tree/0.15.1 [0.15.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.15.0 [0.14.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.14.0 [0.13.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.13.0 diff --git a/nextion/nextion_rtc.py b/nextion/nextion_rtc.py index 6e44e6a..f52075f 100644 --- a/nextion/nextion_rtc.py +++ b/nextion/nextion_rtc.py @@ -83,8 +83,9 @@ def write_rtc_time(self, *args, **kwargs) -> bool: format("2016,11,25,12,34,50", [2016, 11, 25, 12, 34, 50])) - self._logger.debug("Timestamp (ISO8601): {}-{}-{}T{}:{}:{}". - format(year, month, day, hour, minute, second)) + self._nh._logger.debug( + "Timestamp (ISO8601): {}-{}-{}T{}:{}:{}".format( + year, month, day, hour, minute, second)) cmd = "rtc0={}".format(year) self._nh.sendCommand(cmd) @@ -121,7 +122,7 @@ def write_rtc_time(self, *args, **kwargs) -> bool: else: raise NexRtcError("Either use keyword or positional args") - self._logger.debug("Set '{}' to '{}'".format(time_type, time)) + self._nh._logger.debug("Set '{}' to '{}'".format(time_type, time)) rtc_index = self.time_types.index(time_type.lower()) cmd = "rtc{}={}".format(rtc_index, time) diff --git a/nextion/nextion_upload.py b/nextion/nextion_upload.py index d6506b1..20628d9 100644 --- a/nextion/nextion_upload.py +++ b/nextion/nextion_upload.py @@ -112,7 +112,7 @@ def upload(self) -> bool: if not self._downloadTftFile(): raise NexUploadError("Download file error") - self._logger.debug("Download ok") + self._nh._logger.debug("Download ok") return True def _checkFile(self) -> bool: @@ -127,13 +127,13 @@ def _checkFile(self) -> bool: # https://docs.python.org/3/library/os.html#os.stat info = stat(self.file_name) self.file_size = info[6] - self._logger.debug("TFT file size is '{}' bytes". - format(self.file_size)) - self._logger.debug("File check ok") + self._nh._logger.debug("TFT file size is '{}' bytes". + format(self.file_size)) + self._nh._logger.debug("File check ok") result = True else: - self._logger.debug("File '{}' does not exist". - format(self.file_name)) + self._nh._logger.debug("File '{}' does not exist". + format(self.file_name)) return result def _getBaudrate(self) -> int: @@ -147,13 +147,13 @@ def _getBaudrate(self) -> int: _baudrate = 0 for baudrate in baudrate_array: - self._logger.debug("Checking connection with '{}' baud". - format(baudrate)) + self._nh._logger.debug("Checking connection with '{}' baud". + format(baudrate)) if self._searchBaudrate(baudrate): _baudrate = baudrate - self._logger.debug("Success, baudrate set to '{}' baud". - format(_baudrate)) + self._nh._logger.debug("Success, baudrate set to '{}' baud". + format(_baudrate)) return _baudrate return _baudrate @@ -174,8 +174,8 @@ def _searchBaudrate(self, baudrate: int) -> bool: self._nh.sendCommand("connect") sleep(0.1) # necessary, data might not be available otherwise response = self._recvRetString() - self._logger.debug("_searchBaudrate response for '{}' baud: {}". - format(baudrate, response)) + self._nh._logger.debug("_searchBaudrate response for '{}' baud: {}". + format(baudrate, response)) if "comok" in response: return True @@ -193,7 +193,7 @@ def _setDownloadBaudrate(self, baudrate: int) -> bool: :rtype: bool """ cmd = "whmi-wri {},{},0".format(self.file_size, baudrate) - self._logger.debug("Set download baudrate cmd: '{}'".format(cmd)) + self._nh._logger.debug("Set download baudrate cmd: '{}'".format(cmd)) self._nh.sendCommand("") self._nh.sendCommand(cmd) @@ -201,8 +201,8 @@ def _setDownloadBaudrate(self, baudrate: int) -> bool: self._nh._baudrate = baudrate self._nh._uart_init() response = self._recvRetString(500) - self._logger.debug("Set download baudrate response: '{}'". - format(response)) + self._nh._logger.debug( + "Set download baudrate response: '{}'".format(response)) if (0x05).to_bytes(1, 'little') in response: return True return False @@ -222,13 +222,13 @@ def _downloadTftFile(self) -> bool: data_size = update_file.readinto(file_content) if not data_size: - self._logger.debug("Reached EOF, update finished") + self._nh._logger.debug("Reached EOF, update finished") break self._nh._uart.write(file_content) response = self._recvRetString(500) - # self._logger.debug("File download response: '{}'". + # self._nh._logger.debug("File download response: '{}'". # format(response)) if (0x05).to_bytes(1, 'little') in response: diff --git a/nextion/nextion_waveform.py b/nextion/nextion_waveform.py index e90c4f4..b28913b 100644 --- a/nextion/nextion_waveform.py +++ b/nextion/nextion_waveform.py @@ -49,7 +49,7 @@ def addValue(self, ch: int, number: int) -> bool: :rtype: bool """ if ch > 3: - self._logger.debug("Only channels (0-3) supported by waveform") + self._nh._logger.debug("Only channels (0-3) supported by waveform") return False cmd = "add {},{},{}".format(self.cid, ch, number) @@ -67,8 +67,8 @@ def clearChannel(self, ch: int) -> bool: :rtype: bool """ if (ch > 3) and (ch != 255): - self._logger.debug("Only the channels (0-3) or all channels at " - "once (255) can be cleared") + self._nh._logger.debug("Only the channels (0-3) or all channels " + "at once (255) can be cleared") return False cmd = "cle {},{}".format(self.cid, ch)