-
Notifications
You must be signed in to change notification settings - Fork 59
Description
中英双语
Chinese Version & English Version
English Version
Title: [Critical Compatibility Bug] Missing OLED library support on mPython 3.0 board breaks backward compatibility
Describe the bug
The mPython 3.0 board uses a completely different display system (lv_gui based on LVGL) compared to previous mPython 2.x boards (which used oled library for SSD1306 OLED displays). This creates a complete API break with no backward compatibility layer.
Existing code written for mPython 2.x that uses oled.DispChar(), oled.text(), oled.show(), etc. fails with NameError: name 'oled' isn't defined on mPython 3.0 boards. The official documentation does not clearly document this breaking change, and there's no migration guide provided.
To Reproduce
-
Steps to reproduce the behavior:
-
Connect an mPython 3.0 board to your computer
-
Write a simple script that imports the oled library:
python
from mpython import oled
oled.DispChar("Hello World", 0, 0)
oled.show()
Run the script on the mPython 3.0 board
- See error: NameError: name 'oled' isn't defined
Expected behavior
One of the following:
A compatibility layer that maps oled API calls to lv_gui internally (recommended)
An oled compatibility library available for installation on mPython 3.0
Clear documentation about the breaking change with migration examples
A warning in the mPython IDE when trying to use oled on 3.0 hardware
Screenshots
![Error screenshot would show: NameError: name 'oled' isn't defined]
Error message when running legacy code on mPython 3.0
Desktop:
OS: Windows 10
mPython IDE Version: 0.8.7-alpha.2.1919121119141015
Hardware: mPython 3.0 board
Additional context
This affects all users migrating projects from mPython 2.x to 3.0
The mPython simulator also doesn't simulate oled for 3.0 boards
There's no way to install external libraries on mPython boards via pip
The hardware change (OLED → TFT) is understandable, but the API break without migration path is problematic
Suggested solutions:
Provide a compatibility shim library (oled_compat.py)
Update the IDE to detect and convert legacy code
Create comprehensive migration documentation
Consider adding both libraries in future firmware updates
中文版本
标题: [严重兼容性错误] mPython 3.0 掌控板缺少 OLED 库支持,破坏了向后兼容性
问题描述
mPython 3.0 掌控板使用了与之前 mPython 2.x 版本完全不同的显示系统(基于 LVGL 的 lv_gui 库),而 mPython 2.x 使用的是用于 SSD1306 OLED 显示屏的 oled 库。这导致了完全的 API 中断,且没有向后兼容层。
为 mPython 2.x 编写的现有代码(使用 oled.DispChar()、oled.text()、oled.show() 等)在 mPython 3.0 掌控板上运行时会出现 NameError: name 'oled' isn't defined 错误。官方文档没有明确记录这一重大变更,也没有提供迁移指南。
重现步骤:
-
将 mPython 3.0 掌控板连接到计算机
-
编写一个导入 oled 库的简单脚本:
python
from mpython import oled
oled.DispChar("Hello World", 0, 0)
oled.show()
-
在 mPython 3.0 掌控板上运行该脚本
-
看到错误:NameError: name 'oled' isn't defined
期望的行为
以下之一:
提供将 oled API 调用内部映射到 lv_gui 的兼容层(推荐)
提供可在 mPython 3.0 上安装的 oled 兼容库
提供清晰的重大变更文档和迁移示例
在 mPython IDE 中尝试在 3.0 硬件上使用 oled 时显示警告
截图
![错误截图会显示:NameError: name 'oled' isn't defined]
在 mPython 3.0 上运行旧代码时的错误信息
桌面环境
操作系统: Windows 10
mPython IDE 版本: 0.8.7-alpha.2.1919121119141015
硬件: mPython 3.0 掌控板
补充说明
这影响了所有从 mPython 2.x 迁移项目到 3.0 的用户
mPython 模拟器也没有为 3.0 板模拟 oled 库
无法通过 pip 在 mPython 板上安装外部库
硬件变更(OLED → TFT)是可以理解的,但没有迁移路径的 API 中断是有问题的
建议的解决方案:
提供兼容性垫片库(oled_compat.py)
更新 IDE 以检测和转换旧代码
创建全面的迁移文档
考虑在未来的固件更新中添加两个库