Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
742e3ca1bc | ||
|
|
f1a61272a9 | ||
|
|
b8b74b2b8d | ||
|
|
25b9e62f5f | ||
|
|
86e1022ffa |
17
CHANGELOG.md
@@ -1,4 +1,19 @@
|
||||
1.4.2
|
||||
# 1.5.0
|
||||
|
||||
## Release 1.5.0 - 2025/4/7
|
||||
|
||||
1. 重构较多代码, 为2.0做准备. 现在可以通过包含文件来自定义配置了
|
||||
|
||||
2. 修复bug
|
||||
|
||||
## Release 1.4.3 - 2025/4/3
|
||||
|
||||
1. 加入了更多可选配置项, 如 AP 配网地址等
|
||||
|
||||
2. 为ESP32S3优先选择调用 SDIO_1Bit 来驱动SD卡
|
||||
|
||||
4. 修复bug
|
||||
|
||||
## Release 1.4.2 - 2025/3/11
|
||||
|
||||
1. 现在程序可以在Arduino-ESP32的版本高于3.0.0的Arduino集成环境和ESP-IDF (仍需依赖Arduino component, 但不依赖PlatformIO) 中编译成功
|
||||
|
||||
31
README.md
@@ -2,9 +2,30 @@
|
||||
|
||||
[](https://www.ardu-badge.com/readguy)
|
||||
|
||||
<img src="extra/artset/readguy_theme3.png" width="30%" height="auto">
|
||||
## ReadGuy 2.0 预告
|
||||
|
||||
**版本1.4.2正式发布!欢迎分享、star和fork~** 上面的图是项目看板娘, 盖. 可爱的盖姐在等你哟~
|
||||
1. 内置驱动,无其他 不跨平台 多平台
|
||||
|
||||
2. 自定义脚本驱动 不跨平台 多平台
|
||||
|
||||
3. 内置 不自定义 带脚本 跨平台 数据存eeprom或者nvs. 支持从文件系统加载
|
||||
|
||||
4. 文件系统接口优化
|
||||
|
||||
5. 灰度显示优化
|
||||
|
||||
6. 按键逻辑优化: 双按键:按键1点按下一个 长按上一个 长按过程中点按2则功能5 按键2点按确定 长按取消
|
||||
三按键 左键点按松开时候结算: 上一个, 左键长按也是上一个 右键点按长按都是下一个 按住左键按中间功能5 中键点按确定 长按取消
|
||||
|
||||
7. 支持pre_init post_init 等设备限定的脚本,在初始化设备时和设备休眠时都可以执行类似功能. 此外readguy2.0的二进制是兼容1.x的
|
||||
|
||||
8. 摒弃默认刷屏方式使用dispWriter函数 速度太慢, 改为使用两种示例, 正常读取显示和函数读取显示都支持调用
|
||||
|
||||
敬请期待
|
||||
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/readguy_theme3.png?raw=true" width="30%" height="auto">
|
||||
|
||||
**版本1.5.0正式发布!欢迎分享、star和fork~** 上面的图是项目看板娘, 盖. 可爱的盖姐在等你哟~
|
||||
|
||||
**即将发布7个全新的屏幕驱动: 欢迎支持! (详见后面的驱动表格)**
|
||||
|
||||
@@ -20,9 +41,9 @@
|
||||
|
||||
### 一次编译即可使程序兼容多种屏幕!
|
||||
|
||||
<img src="extra/artset/readguy_girl.png" width="25%" height="auto">
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/readguy_girl.png?raw=true" width="25%" height="auto">
|
||||
|
||||
<img src="extra/artset/view.jpg" width="auto" height="auto">
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/view.jpg?raw=true" width="auto" height="auto">
|
||||
|
||||
#### 目前支持ESP芯片平台、多种屏幕型号、1~3个按钮操控、SD卡、前置光亮度控制!
|
||||
|
||||
@@ -227,7 +248,7 @@ firmware.bin 0x10000
|
||||
|
||||
5. 编译目标是`ESP32`且使用`ESP-IDF arduino component`时, 需要单独安装[`LittleFS`](https://github.com/joltwallet/esp_littlefs)库来实现相关功能. 在项目内新建文件夹`components`, 在`components`文件夹内放入刚刚克隆的`LittleFS`库. *详见下图**上**方红框*. (使用纯arduino时跳过此步骤)
|
||||
|
||||
<img src="extra/artset/build_dir_structure.png" width="20%" height="auto">
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/build_dir_structure.png?raw=true" width="20%" height="auto">
|
||||
|
||||
6. 把`readguy`的`extra`文件夹内的`platformio`文件夹内所有文件都放在当前目录. 这些文件包含推荐的ESP32 sdkconfig, flash分区表等文件. 使用`pio run -t menuconfig`可以更改项目的menuconfig数据. (使用纯arduino时跳过此步骤)
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void setup(){
|
||||
//使用guy.guyFS()函数返回可用的文件系统. 默认为SD卡. 当SD卡不可用时, 自动切换到内置的LittleFS.
|
||||
|
||||
//显示打开的图片信息(宽度和高度), 和剩余内存
|
||||
Serial.printf("[%lu] sp.w: %d, h: %d, res: %d.\n",millis(),sp.width(),sp.height(),guy.getFreeMem());
|
||||
Serial.printf("[%lu] sp.w: %d, h: %d, res: %d.\n",millis(),(int)sp.width(),(int)sp.height(),guy.getFreeMem());
|
||||
|
||||
guy.drawImage(sp,10,10); //使用抖动像素的方式显示图片(不是灰度, 只有黑点和白点的那种显示效果)
|
||||
|
||||
|
||||
@@ -40,51 +40,63 @@
|
||||
#include "readguy.h" //包含readguy_driver 基础驱动库
|
||||
|
||||
ReadguyDriver guy;//新建一个readguy对象, 用于显示驱动.
|
||||
|
||||
int c=1;
|
||||
void setup(){
|
||||
Serial.begin(115200); //初始化串口
|
||||
guy.init(); //初始化readguy_driver 基础驱动库. 尽管初始化过程会刷屏, 但此示例不会用到屏幕.
|
||||
//if(guy.width()<guy.height()) guy.setRotation(1); //横向
|
||||
if(guy.width()<200) guy.setRotation(1); //对于小屏幕, 设置横向
|
||||
c = guy.getButtonsCount(); //此函数用于返回设备有多少个按键.
|
||||
|
||||
Serial.println(F("[readguy] Button demo")); //显示文本 默认是不支持中文显示的.
|
||||
guy.println("Button demo"); //显示文本 默认是不支持中文显示的.
|
||||
guy.println(F("Button demo."));
|
||||
guy.println(F("Press the buttons in any way!"));
|
||||
guy.println(F("Information will show"));
|
||||
guy.println(F("on the EPD display."));
|
||||
guy.println();
|
||||
guy.print(F("Your device supports "));
|
||||
guy.printf_P(PSTR("%d button%c.\r\n"),c,c==1?' ':'s'); //显示文本
|
||||
guy.display();//刷新墨水屏.
|
||||
guy.setButtonSpecial(true);//对于三按键系统,打开此模式将会允许双击进行特殊操作(如切换键盘)
|
||||
//guy.setButtonSpecial(true); //对于拨轮, 无法做到按住按钮1按下按钮2
|
||||
}
|
||||
|
||||
void loop(){
|
||||
int val = guy.getBtn(); //此函数用于获取按键状态 没有按键按下时 返回0.
|
||||
auto val = guy.getBtn(); //此函数用于获取按键状态 没有按键按下时 返回0.
|
||||
|
||||
if(val>0){
|
||||
int c = guy.getButtonsCount(); //此函数用于返回设备有多少个按键. [最近更新的函数]
|
||||
if(val!=guyBNone){
|
||||
guy.fillRect(0,guy.height()-10, guy.width(),10,1);
|
||||
guy.setCursor(2,guy.height()-10);
|
||||
switch (val){
|
||||
case 1: //下一个 手势
|
||||
if(c==1) guy.println("key single clicked!");
|
||||
else if(c==2) guy.println("Left key clicked!");
|
||||
else if(c==3) guy.println("Right key clicked!");
|
||||
case guyBNext: //下一个 手势
|
||||
if(c==1) guy.println(F("key single clicked!"));
|
||||
else if(c==2) guy.println(F("Left key clicked!"));
|
||||
else if(c==3) guy.println(F("Right key clicked!"));
|
||||
break;
|
||||
case 2: //上一个 手势
|
||||
if(c==1) guy.println("key long pressed!");
|
||||
else if(c==2) guy.println("Left key long pressed!");
|
||||
else if(c==3) guy.println("Left key clicked!");
|
||||
case guyBPrev: //上一个 手势
|
||||
if(c==1) guy.println(F("key long pressed!"));
|
||||
else if(c==2) guy.println(F("Left key long pressed!"));
|
||||
else if(c==3) guy.println(F("Left key clicked!"));
|
||||
break;
|
||||
case 3: //特殊 手势
|
||||
if(c==1) guy.println("key clicked and pressed!");
|
||||
else if(c==2) guy.println("Right clicked at left pressing!");
|
||||
else if(c==3) guy.println("Centre key double clicked!");
|
||||
case guyBSpecial: //特殊 手势
|
||||
if(c==1) guy.println(F("key clicked and pressed!"));
|
||||
else if(c==2) guy.println(F("Right clicked at left pressing!"));
|
||||
else if(c==3) guy.println(F("Centre key double clicked!"));
|
||||
break;
|
||||
case 4: //确定 手势
|
||||
if(c==1) guy.println("key double clicked!");
|
||||
else if(c==2) guy.println("Right key clicked!");
|
||||
else if(c==3) guy.println("Centre key clicked!");
|
||||
case guyBOK: //确定 手势
|
||||
if(c==1) guy.println(F("key double clicked!"));
|
||||
else if(c==2) guy.println(F("Right key clicked!"));
|
||||
else if(c==3) guy.println(F("Centre key clicked!"));
|
||||
break;
|
||||
case 8: //返回 手势
|
||||
if(c==1) guy.println("key triple clicked!");
|
||||
else if(c==2) guy.println("Right key long pressed!");
|
||||
else if(c==3) guy.println("Centre key long pressed!");
|
||||
case guyBCancel: //返回 手势
|
||||
if(c==1) guy.println(F("key triple clicked!"));
|
||||
else if(c==2) guy.println(F("Right key long pressed!"));
|
||||
else if(c==3) guy.println(F("Centre key long pressed!"));
|
||||
break;
|
||||
default: //未知手势
|
||||
guy.println(F("Unknown gesture!"));
|
||||
break;
|
||||
}
|
||||
guy.display();
|
||||
guy.scroll(0,-8);
|
||||
}
|
||||
delay(10);
|
||||
}/* END OF FILE. ReadGuy project.
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_chinese1[14241]=
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_chinese1[14241]= {
|
||||
"\233\0\4\2\5\5\3\5\6\22\22\376\374\13\375\14\374\1\351\3\364\5\310 \6\0\60\242\0!\10\301"
|
||||
"\375\241\360 \42\42\11\304\270\242\20\361I\0#\34\210\21\242\23\11EB\221\310`\20)\212\204\42\241"
|
||||
"Hd\60\210\24EB\221\14\0$\32\247\361\241\23\32(\42\21ID\22J\244V\211PD\22\221T"
|
||||
@@ -485,9 +485,10 @@ const PROGMEM uint8_t ctg_u8g2_wqy12_chinese1[14241]=
|
||||
"\61\17\322\301\23\317\14\6\212\262Tb\23Kd\6\203H\42\223J\14\6\222\302HQ&\322\242I\213"
|
||||
"&-\272I\204\62\211\134\246H\223J\210r\1\237 \60\15\332\301\223\34\15\42\311\310 \63\210$#"
|
||||
"\311\310\340@\17HD\22\221\26\221D$T\222\210$\42-\42\211\204\250B\21Id\6\31U\0\0"
|
||||
"";
|
||||
""
|
||||
};
|
||||
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_gb2312[208522]=
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_gb2312[208522]= {
|
||||
"s\0\3\2\4\4\5\5\5\15\15\0\376\10\376\12\377\1m\2\347\5\23 \5\0\60Z!\7\221\22"
|
||||
"Z\234\2\42\10\64\361ZD\246\0#\17\226\20\336D-\303\22\365\62,Q\13\0$\17\245\360Ye"
|
||||
"KE\311D-Q*[\4%\21\226\360\331DI\27-\11\323$J\272h\11\0&\16\205\20Ze"
|
||||
@@ -7004,8 +7005,10 @@ const PROGMEM uint8_t ctg_u8g2_wqy12_gb2312[208522]=
|
||||
"\13\377\134\10\261\366q<\10\377]\15\303\362qdQ[\22u\211\0\377^\14<p\362\355\200f\7"
|
||||
"\26\0\377\340\23\227\22\362fCT\321\242Z\224%Y\42U$\0\377\341\26\252\21\362\352@\24\347P"
|
||||
"\16\245\303\220\3\361*M\221&\1\377\343\7\34Ps|\377\345\26\251\21rlK\232\325\206!L\302"
|
||||
"aHs$Gr`\3\0";
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12[626234]=
|
||||
"aHs$Gr`\3\0"
|
||||
};
|
||||
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12[626234]= {
|
||||
"\324\0\3\3\4\4\5\5\5\15\15\0\376\10\376\12\377\1w\2\370\5$ \5\0\60Z!\7\221\22"
|
||||
"Z\230\2\42\10\64\361Z\204\224\2#\16\226\20\336\204\262XBy\261\204\262\0$\21\245\360Y\305&"
|
||||
")\222\230P\26\221\244\314B\0%\22\226\360\331\204\42\271\310\42\301h$\24\311E\26\1&\20\205\20"
|
||||
@@ -26575,7 +26578,9 @@ const PROGMEM uint8_t ctg_u8g2_wqy12[626234]=
|
||||
"\377[\15\303\367qEBYb\241\334\2\377\134\10\261\366q\34\10\377]\16\303\362q\304B\331\42\241"
|
||||
"\134B\0\377^\15<p\362\315\1\62u\300\4\0\377\340\24\227\22\362\306H)\262PZ(\26\211E"
|
||||
"D)\42\0\377\341\27\252\21\362\312\1\241p\34\24\7E\357\200\360T\64\12\311D\0\377\343\10\34P"
|
||||
"s\34\12\377\345\25\251\21r\314&\321X\332\61\22\274\306!qH\34\60\3\0";
|
||||
"s\34\12\377\345\25\251\21r\314&\321X\332\61\22\274\306!qH\34\60\3\0"
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
|
||||
ReadguyDriver guy;//新建一个readguy对象, 用于显示驱动.
|
||||
|
||||
extern const uint8_t ctg_u8g2_wqy12_chinese1[]; //声明中文字体文件
|
||||
extern const uint8_t ctg_u8g2_wqy12_gb2312[]; //声明中文字体文件
|
||||
|
||||
const lgfx::U8g2font cn_font(ctg_u8g2_wqy12_chinese1); //U8G2格式中文字体转化为LGFX格式字体
|
||||
const lgfx::U8g2font cn_font(ctg_u8g2_wqy12_gb2312); //U8G2格式中文字体转化为LGFX格式字体
|
||||
|
||||
void setup(){
|
||||
|
||||
@@ -69,7 +69,7 @@ void setup(){
|
||||
|
||||
guy.setCursor(10,10);
|
||||
|
||||
guy.print("中文");
|
||||
guy.print("你好, 中文");
|
||||
|
||||
guy.display();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_chinese1[14241]=
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_chinese1[14241]= {
|
||||
"\233\0\4\2\5\5\3\5\6\22\22\376\374\13\375\14\374\1\351\3\364\5\310 \6\0\60\242\0!\10\301"
|
||||
"\375\241\360 \42\42\11\304\270\242\20\361I\0#\34\210\21\242\23\11EB\221\310`\20)\212\204\42\241"
|
||||
"Hd\60\210\24EB\221\14\0$\32\247\361\241\23\32(\42\21ID\22J\244V\211PD\22\221T"
|
||||
@@ -485,9 +485,10 @@ const PROGMEM uint8_t ctg_u8g2_wqy12_chinese1[14241]=
|
||||
"\61\17\322\301\23\317\14\6\212\262Tb\23Kd\6\203H\42\223J\14\6\222\302HQ&\322\242I\213"
|
||||
"&-\272I\204\62\211\134\246H\223J\210r\1\237 \60\15\332\301\223\34\15\42\311\310 \63\210$#"
|
||||
"\311\310\340@\17HD\22\221\26\221D$T\222\210$\42-\42\211\204\250B\21Id\6\31U\0\0"
|
||||
"";
|
||||
""
|
||||
};
|
||||
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_gb2312[208522]=
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12_gb2312[208522]= {
|
||||
"s\0\3\2\4\4\5\5\5\15\15\0\376\10\376\12\377\1m\2\347\5\23 \5\0\60Z!\7\221\22"
|
||||
"Z\234\2\42\10\64\361ZD\246\0#\17\226\20\336D-\303\22\365\62,Q\13\0$\17\245\360Ye"
|
||||
"KE\311D-Q*[\4%\21\226\360\331DI\27-\11\323$J\272h\11\0&\16\205\20Ze"
|
||||
@@ -7004,8 +7005,10 @@ const PROGMEM uint8_t ctg_u8g2_wqy12_gb2312[208522]=
|
||||
"\13\377\134\10\261\366q<\10\377]\15\303\362qdQ[\22u\211\0\377^\14<p\362\355\200f\7"
|
||||
"\26\0\377\340\23\227\22\362fCT\321\242Z\224%Y\42U$\0\377\341\26\252\21\362\352@\24\347P"
|
||||
"\16\245\303\220\3\361*M\221&\1\377\343\7\34Ps|\377\345\26\251\21rlK\232\325\206!L\302"
|
||||
"aHs$Gr`\3\0";
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12[626234]=
|
||||
"aHs$Gr`\3\0"
|
||||
};
|
||||
|
||||
const PROGMEM uint8_t ctg_u8g2_wqy12[626234]= {
|
||||
"\324\0\3\3\4\4\5\5\5\15\15\0\376\10\376\12\377\1w\2\370\5$ \5\0\60Z!\7\221\22"
|
||||
"Z\230\2\42\10\64\361Z\204\224\2#\16\226\20\336\204\262XBy\261\204\262\0$\21\245\360Y\305&"
|
||||
")\222\230P\26\221\244\314B\0%\22\226\360\331\204\42\271\310\42\301h$\24\311E\26\1&\20\205\20"
|
||||
@@ -26575,7 +26578,9 @@ const PROGMEM uint8_t ctg_u8g2_wqy12[626234]=
|
||||
"\377[\15\303\367qEBYb\241\334\2\377\134\10\261\366q\34\10\377]\16\303\362q\304B\331\42\241"
|
||||
"\134B\0\377^\15<p\362\315\1\62u\300\4\0\377\340\24\227\22\362\306H)\262PZ(\26\211E"
|
||||
"D)\42\0\377\341\27\252\21\362\312\1\241p\34\24\7E\357\200\360T\64\12\311D\0\377\343\10\34P"
|
||||
"s\34\12\377\345\25\251\21r\314&\321X\332\61\22\274\306!qH\34\60\3\0";
|
||||
"s\34\12\377\345\25\251\21r\314&\321X\332\61\22\274\306!qH\34\60\3\0"
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
|
||||
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 578 KiB |
|
Before Width: | Height: | Size: 600 KiB |
|
Before Width: | Height: | Size: 339 KiB |
@@ -11,7 +11,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/fsender/readguy"
|
||||
},
|
||||
"version": "1.4.2",
|
||||
"version": "1.5.0",
|
||||
"frameworks": "arduino",
|
||||
"platforms": ["espressif32", "espressif8266"],
|
||||
"headers": "readguy.h",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=readguy
|
||||
version=1.4.2
|
||||
version=1.5.0
|
||||
author=fsender <f_ender@163.com>
|
||||
maintainer=fsender <f_ender@163.com>
|
||||
sentence=A free E-paper display driver library supports 16-level greyscale.
|
||||
|
||||
@@ -59,7 +59,7 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
#include "guy_button.h"
|
||||
#include "guy_driver_config.h"
|
||||
#include "guy_config_host.h"
|
||||
|
||||
// initalize static counter
|
||||
|
||||
|
||||
@@ -63,10 +63,6 @@ SOFTWARE.
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <stdint.h>
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP8266)
|
||||
#include <functional>
|
||||
#endif
|
||||
#include <Arduino.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
|
||||
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
|
||||
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
|
||||
* @file guy_epaper_config.h
|
||||
* @file guy_config_host.h
|
||||
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
|
||||
* @brief EPD驱动基础配置文件. 用户可以根据自己对库的编译需求来修改此文件.
|
||||
* @brief readguy 配置主文件. 如果要修改配置请移步 guy_driver_config.h
|
||||
* @version 1.0
|
||||
* @date 2023-09-21
|
||||
* @date create: 2025/4/7
|
||||
* last modify: 2025/4/7
|
||||
|
||||
* @attention
|
||||
* Copyright (c) 2022-2023 FriendshipEnder
|
||||
* Copyright (c) 2022-2025 FriendshipEnder
|
||||
*
|
||||
* Apache License, Version 2.0
|
||||
*
|
||||
@@ -26,20 +27,113 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _READGUY_CONFIG_HOST_H_FILE
|
||||
#define _READGUY_CONFIG_HOST_H_FILE
|
||||
|
||||
#ifndef _GUY_E_PAPER_CONFIG_H_FILE
|
||||
#define _GUY_E_PAPER_CONFIG_H_FILE
|
||||
#if __has_include("readguy_user_config.h")
|
||||
|
||||
#undef DYNAMIC_PIN_SETTINGS
|
||||
#undef READGUY_NVS_PROJECTNAME
|
||||
#undef READGUY_NVS_CONFIGKEY
|
||||
#undef READGUY_NVS_DRIVERKEY
|
||||
#undef READGUY_ENABLE_WIFI
|
||||
#undef READGUY_ESP_ENABLE_WIFI
|
||||
#undef READGUY_CONF_AP_SSID
|
||||
#undef READGUY_CONF_AP_PASS
|
||||
#undef READGUY_USE_DEFAULT_ICON
|
||||
#undef READGUY_MDNS_SERVICE
|
||||
#undef READGUY_UPDATE_SERVER
|
||||
#undef READGUY_ENABLE_I2C
|
||||
#undef READGUY_ENABLE_SD
|
||||
#undef READGUY_USE_LITTLEFS
|
||||
#undef READGUY_ESP8266_EEPROM_OFFSET
|
||||
#undef READGUY_ALLOW_DC_AS_BUTTON
|
||||
#undef READGUY_ALLOW_EPDCS_AS_BUTTON
|
||||
#undef READGUY_ALLOW_SDCS_AS_BUTTON
|
||||
#undef READGUY_DEFAULT_MIN_DEBOUNCE_MS
|
||||
#undef READGUY_LONG_PRESS_MS
|
||||
#undef READGUY_DOUBLE_PRESS_MS
|
||||
#undef READGUY_LONG_REPEAT_MS
|
||||
#undef BTN_LOOPTASK_STACK
|
||||
#undef BTN_LOOPTASK_CORE_ID
|
||||
#undef BTN_LOOPTASK_PRIORITY
|
||||
#undef BTN_LOOPTASK_DELAY
|
||||
#undef ESP8266_SPI_FREQUENCY
|
||||
#undef ESP32_DISP_FREQUENCY
|
||||
#undef ESP32_SD_SPI_FREQUENCY
|
||||
#undef ESP32_SD_MMC_FREQUENCY
|
||||
#undef READGUY_SERIAL_DEBUG
|
||||
#undef READGUY_shareSpi
|
||||
#undef READGUY_epd_type
|
||||
#undef READGUY_epd_mosi
|
||||
#undef READGUY_epd_sclk
|
||||
#undef READGUY_epd_cs
|
||||
#undef READGUY_epd_dc
|
||||
#undef READGUY_epd_rst
|
||||
#undef READGUY_epd_busy
|
||||
#undef READGUY_sd_miso
|
||||
#undef READGUY_sd_mosi
|
||||
#undef READGUY_sd_sclk
|
||||
#undef READGUY_sd_cs
|
||||
#undef READGUY_i2c_sda
|
||||
#undef READGUY_i2c_scl
|
||||
#undef READGUY_btn1
|
||||
#undef READGUY_btn2
|
||||
#undef READGUY_btn3
|
||||
#undef READGUY_bl_pin
|
||||
#undef READGUY_user1
|
||||
#undef READGUY_user2
|
||||
#undef READGUY_user3
|
||||
#undef READGUY_user4
|
||||
#undef READGUY_user5
|
||||
#undef READGUY_user6
|
||||
#undef READGUY_user7
|
||||
#undef READGUY_user8
|
||||
#undef READGUY_user9
|
||||
#undef READGUY_user10
|
||||
#undef READGUY_rtc_type
|
||||
#undef MEPD_DEBUG_WAVE
|
||||
#undef MEPD_DEBUG_WAITTIME
|
||||
#undef FLOYD_STEINBERG_DITHERING
|
||||
#undef FLOYD_DITHERING_16GREY
|
||||
#undef READGUY_583A_DUAL_BUFFER
|
||||
#include "readguy_user_config.h"
|
||||
#else
|
||||
#include "guy_driver_config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ESP8266 //应用于
|
||||
#define _READGUY_PLATFORM "ESP8266"
|
||||
//#define READGUY_IDF_TARGET_WITHOUT_FSPI //该器件不能使用fspi
|
||||
#else
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define _READGUY_PLATFORM "ESP32"
|
||||
#define READGUY_IDF_TARGET_WITH_VSPI //该器件拥有vspi
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#define _READGUY_PLATFORM "ESP32S2"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define _READGUY_PLATFORM "ESP32S3"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#define _READGUY_PLATFORM "ESP32C3"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6) //新增 ESP32C6 (暂未测试)
|
||||
#define _READGUY_PLATFORM "ESP32C6"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#else
|
||||
#define _READGUY_PLATFORM "Unknown" //Prepare for ESP32-C6, H7, etc.
|
||||
#warning Unknown platform! Readguy will run with unexpected (maybe hardware) errors!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define MEPD_DEBUG_WAVE 16 //取消此行注释来监视SPI的通信数据 (用于debug), 可以查看主控和屏幕的通信数据
|
||||
//#define MEPD_DEBUG_WAITTIME //显示墨水屏的刷新时间, 单位是毫秒
|
||||
#define FLOYD_STEINBERG_DITHERING //默认使用更好的floyd steinberg抖动算法,取消注释则用bayer图案抖动算法
|
||||
#define FLOYD_DITHERING_16GREY //使用更好的floyd steinberg抖动算法显示16阶灰度,取消注释则使用阈值填充
|
||||
|
||||
// ***********************************************************************
|
||||
|
||||
//设备设置: 取消对应设备就可以直接禁用掉对应设备
|
||||
//非常不建议用户在应用程序中禁用掉设备. 实测根本不会节省很多的空间. 如果要节省代码占用的flash空间,
|
||||
//请在字库上下功夫.
|
||||
//要想省空间, 请关闭wifi配置功能并避免使用wifi, 或者在程序中 (尤其是图片素材和字库素材上) 下功夫.
|
||||
//如果程序不想支持此型号(为了节省flash),请注释掉这一行, 实测每个设备只能节省100字节左右的flash空间
|
||||
#define READGUY_DEV_154A 0 //1.54寸标准, 甘草酸不酸使用的1.54默认屏幕型号. 1.54汉朔价签也选这个
|
||||
#define READGUY_DEV_154B 1 //1.54寸Lilygo, lilygo的1.54触摸和1.54背光墨水屏. GDEH0154D67
|
||||
@@ -68,7 +162,5 @@
|
||||
|
||||
#define EPD_DRIVERS_NUM_MAX 21 //此选项请不要取消注释掉, 有几个屏幕就写多少.
|
||||
|
||||
#define READGUY_583A_DUAL_BUFFER //对于单缓存的5.83屏幕,启用双缓存支持. 相当不建议注释掉,否则不能刷白色
|
||||
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||
Copyright (C) 2025 FriendshipEnder. */
|
||||
@@ -7,15 +7,17 @@
|
||||
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
|
||||
* @brief readguy 基础配置文件. 用户可以根据自己对库的编译需求来修改此文件.
|
||||
*
|
||||
* 1.5.0 新增!
|
||||
* 在项目目录里拷贝本文件并重命名为 "readguy_user_config.h" 即可使本配置文件仅在当前项目有效
|
||||
*
|
||||
* 如果你希望在程序代码内包含引脚定义, 请参考此文件下方的注释来确定并编译
|
||||
* 这样就可以只针对你设计的这一个硬件来设定引脚功能.
|
||||
* 关于屏幕配置, 请参考 guy_epaper/guy_epaper_config.h 文件来配置到底哪些屏幕型号的屏幕会被包含进来
|
||||
* 关于屏幕配置, 请参考最下方(284行到文件末尾)来配置到底哪些屏幕型号的屏幕会被包含进来
|
||||
|
||||
* 可以禁用WiFi功能来减少程序的flash消耗
|
||||
|
||||
* @version 1.1
|
||||
* @date create: 2023-09-21
|
||||
* last modify: 2023-11-11
|
||||
* last modify: 2025/4/7
|
||||
|
||||
* @attention
|
||||
* Copyright (c) 2022-2023 FriendshipEnder
|
||||
@@ -39,15 +41,18 @@
|
||||
|
||||
// *** Do not include any file here!
|
||||
|
||||
/*
|
||||
#define _EPD_CS_PIN 15 //D8, 显示屏的片选引脚
|
||||
#define _EPD_DC_PIN 5 //D1, 显示屏的DC引脚
|
||||
#define _EPD_RST_PIN -1 //reserved 保留的重置引脚
|
||||
#define _EPD_BUSY_PIN 4 //D2 显示屏的Busy引脚
|
||||
#define _SD_CS_PIN 0 //D3, SD卡的片选引脚
|
||||
#define _BtnL 5 //D1, 左键
|
||||
#define _BtnM 12 //中间键 D6引脚
|
||||
#define _BtnR 2 //D4 右键
|
||||
/**************************** 请不要取消注释这里! *****************************
|
||||
********* 这里的设置项是无效的, 仅仅用于标注一些开发板的引脚预定义数据. *********
|
||||
********** 部分热门的, 创新的带墨水屏开发板的引脚定义可能会罗列在这里. **********
|
||||
*****************************************************************************
|
||||
(无效设置项) #define _EPD_CS_PIN 15 //D8, 显示屏的片选引脚
|
||||
(无效设置项) #define _EPD_DC_PIN 5 //D1, 显示屏的DC引脚
|
||||
(无效设置项) #define _EPD_RST_PIN -1 //reserved 保留的重置引脚
|
||||
(无效设置项) #define _EPD_BUSY_PIN 4 //D2 显示屏的Busy引脚
|
||||
(无效设置项) #define _SD_CS_PIN 0 //D3, SD卡的片选引脚
|
||||
(无效设置项) #define _BtnL 5 //D1, 左键
|
||||
(无效设置项) #define _BtnM 12 //中间键 D6引脚
|
||||
(无效设置项) #define _BtnR 2 //D4 右键
|
||||
|
||||
//对于甘草酸不酸的新版本板子:
|
||||
//busy 4 rst 2 dc 0 cs 15 sck / mosi / sdcs 5 btnL rx(3) btnM 0
|
||||
@@ -70,8 +75,42 @@
|
||||
/ 关闭此选项自动禁用wifi功能. 如需wifi功能需要自己在程序里加. 但也可以大幅减少flash的占用 */
|
||||
#define DYNAMIC_PIN_SETTINGS
|
||||
|
||||
/// @brief NVS存储配置数据时用的项目名. 必须小于8个字符, 为节省内存, 项目依赖此处的内存块仅分配了8字节.
|
||||
#define READGUY_NVS_PROJECTNAME "readguy"
|
||||
|
||||
/// @brief NVS存储配置数据时用的配置数据键名. 必须小于8个字符, 为节省内存, 项目依赖此处的内存块仅分配了8字节.
|
||||
#define READGUY_NVS_CONFIGKEY "hwconf"
|
||||
|
||||
/// @brief 当使用自定义驱动 (customDriver) 时会通过NVS访问驱动代码. 必须小于8个字符.
|
||||
/// @note 有关自定义驱动, 可以参考 readme 中提到的在 2.0 版本即将到来的特性.
|
||||
#define READGUY_NVS_DRIVERKEY "driver"
|
||||
|
||||
/// @brief 启用WIFI配网功能.必须先启用 #define DYNAMIC_PIN_SETTINGS. 此选项对 ESP32xx 会减少大量可用flash.
|
||||
#define READGUY_ENABLE_WIFI //会破坏跨平台特性
|
||||
/// @note 注释掉它会破坏跨平台特性
|
||||
#define READGUY_ENABLE_WIFI
|
||||
|
||||
/// @brief AP配网热点的名称和密码. 不可注释
|
||||
#define READGUY_CONF_AP_SSID "readguy"
|
||||
#define READGUY_CONF_AP_PASS "12345678"
|
||||
|
||||
/** @brief 使用服务器或者WIFI配网时, 在网页上显示项目默认的图标, 默认图标会额外占用1150字节的flash空间
|
||||
/ 如果想用自己的图标数据库, 请参考配网示例, 在配置时候加入下方的代码. 此处提供了代码.
|
||||
``` C++
|
||||
typedef ReadguyDriver::ReadguyWebServer* server_t; //类型名太长太繁琐, 使用typedef减短
|
||||
typedef ReadguyDriver::serveFunc event_t ; //存储一个WiFi功能事件.
|
||||
const uint8_t icon[] = {}; //你的图标数据. 可直接把 *.ico 格式图标文件转化为字节数组, 拷贝到此处
|
||||
void sendIcon(server_t sv){ sv->send_P(200, "image/x-icon", (const char *)icon,sizeof(icon)); }
|
||||
event_t server_event={"","/favicon",sendIcon};
|
||||
guy.server_setup(String("Custom Icon"),&server_event,1); //初始化服务器.
|
||||
``` */
|
||||
//#define READGUY_USE_DEFAULT_ICON
|
||||
|
||||
/** @brief 使用MDNS域名服务. 在设备联网或者打开热点之后, 可以通过域名 readguy.local 来访问配网主页
|
||||
/ 关闭本功能可节省少许flash. 如需自定义服务名称, 则您可更改此处的字符串, 访问 <自定义名称>.local */
|
||||
//#define READGUY_MDNS_SERVICE "readguy"
|
||||
|
||||
/// @brief 使用固件更新服务. 关闭本功能可节省少许flash. 如需自定义链接名称, 则您可更改此处的字符串.
|
||||
//#define READGUY_UPDATE_SERVER "固件更新"
|
||||
|
||||
/** @brief 启用I2C功能. 可用于联网时钟, 温度计, 陀螺仪等外设. 目前暂不支持库内使用类似函数. 仅可以提供引脚定义
|
||||
/ @note 现在库提供了获取已存的I2C引脚的接口, 使用时请使用 getI2cSda() 和 getI2cScl() 函数获取I2C的引脚.
|
||||
@@ -148,6 +187,7 @@
|
||||
|
||||
/// @brief ESP32驱动SD卡的速率. 当ESP32在与SD卡共享SPI时, 屏幕依据此处的速率.
|
||||
#define ESP32_SD_SPI_FREQUENCY 20000000
|
||||
#define ESP32_SD_MMC_FREQUENCY 40000
|
||||
|
||||
/// @brief debug专用, 请保持处于注释状态. 正常开机从NVS读取引脚配置数据, 取消注释则每次开机需要重新配置
|
||||
//#define READGUY_INDEV_DEBUG 1
|
||||
@@ -155,6 +195,21 @@
|
||||
/// @brief 串口显示刷屏功能等的信息. 如果是对flash大小要求十分敏感, 或者希望减少串口数据, 可以关闭
|
||||
#define READGUY_SERIAL_DEBUG
|
||||
|
||||
/// @brief 对于单缓存的5.83屏幕,启用双缓存支持. 相当不建议注释掉,否则不能刷白色
|
||||
#define READGUY_583A_DUAL_BUFFER
|
||||
|
||||
/// @brief 取消此行注释来监视SPI的通信数据 (用于debug), 可以查看主控和屏幕的通信数据
|
||||
//#define MEPD_DEBUG_WAVE 16
|
||||
|
||||
/// @brief 显示墨水屏的刷新时间, 单位是毫秒
|
||||
//#define MEPD_DEBUG_WAITTIME
|
||||
|
||||
/// @brief 默认使用更好的floyd steinberg抖动算法,取消注释则用bayer图案抖动算法
|
||||
#define FLOYD_STEINBERG_DITHERING
|
||||
|
||||
/// @brief 使用更好的floyd steinberg抖动算法显示16阶灰度,取消注释则使用阈值填充
|
||||
#define FLOYD_DITHERING_16GREY
|
||||
|
||||
#ifndef DYNAMIC_PIN_SETTINGS
|
||||
#ifdef ESP8266
|
||||
#define READGUY_shareSpi 1 //EPD和SD卡是否共享SPI,对于ESP8266必须设置为1
|
||||
@@ -230,8 +285,12 @@
|
||||
#define READGUY_user10 -1 //useless
|
||||
#endif
|
||||
|
||||
#define READGUY_rtc_type 0 //使用的RTC型号. 现已弃用 RTC 功能. 保留是为了兼容性 让代码更简单维护
|
||||
#elif defined(READGUY_ENABLE_WIFI)
|
||||
#define READGUY_rtc_type 0 //使用的RTC型号. RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
|
||||
// ******************************************************************
|
||||
// ********************** 以下内容不建议用户更改 **********************
|
||||
// ******************************************************************
|
||||
#elif defined(READGUY_ENABLE_WIFI) // READGUY_ENABLE_WIFI 依赖 DYNAMIC_PIN_SETTINGS
|
||||
#define READGUY_ESP_ENABLE_WIFI //使用WIFI进行配网等功能
|
||||
#endif
|
||||
#undef READGUY_ENABLE_WIFI
|
||||
|
||||
@@ -96,30 +96,34 @@ const unsigned char drvSSD168x::WS_20_30[42] =
|
||||
};
|
||||
const unsigned char drvSSD168x::VSH_table[32]=
|
||||
{/*0x00,0xbc,0xc1,0xc6,0xcb,0x23,0x26,0x28,0x2a,0x2c,0x2e,0x32,0x35,0x39,0x3d,0x41,*/
|
||||
0x00,0x24,0x28,0x2c,0x30,0x33,0x36,0x38,0x3a,0x3c,0x3e,0x40,0x42,0x44,0x45,0x46,
|
||||
0x00,0xac,0xb0,0xb6,0xbd,0xc5,0xce,0x26,0x2c,0x33,0x3a,0x42,0x4a,0x4a,0x4a,0x4a,
|
||||
0x00,0x41,0x3c,0x37,0x32,0x2d,0x28,0x23,0xcb,0xc6,0xc1,0xbc,0xb7,0xb2,0xb0,0xae};
|
||||
|
||||
|
||||
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
|
||||
void drvSSD168x::SetLut() {
|
||||
static const unsigned char VSH_repeat[16]={
|
||||
0,1,1,1,1,1,1,1,1,1,1,1,1,2,3,4
|
||||
};
|
||||
unsigned int i;
|
||||
guy_epdCmd(0x3f);
|
||||
guy_epdParam(greyScaling?0x07:0x22);
|
||||
guy_epdParam(greyScaling?0x07:0x02); //greyScaling?0x07:0x22
|
||||
guy_epdCmd(0x03); // gate voltage
|
||||
guy_epdParam(0x17);
|
||||
guy_epdParam(0x17); //0x17 orig
|
||||
guy_epdCmd(0x04); // source voltage
|
||||
guy_epdParam(greyScaling?pgm_read_byte(VSH_table+16+iLut):pgm_read_byte(VSH_table+iLut));
|
||||
guy_epdParam(0xA8); // VSH2
|
||||
guy_epdParam(0x32); // VSL
|
||||
guy_epdCmd(0x2c); // VCOM
|
||||
guy_epdParam(0x28);
|
||||
unsigned char i;
|
||||
guy_epdParam(0x20); //0x28 orig
|
||||
guy_epdCmd(0x32);
|
||||
if(_part){
|
||||
for(i=0;i<5;i++){
|
||||
guy_epdParam(i==1?0x80:(i==(greyScaling?0:2)?0x40:0x00));
|
||||
for(int j=0;j<11;j++) guy_epdParam(0);
|
||||
}
|
||||
guy_epdParam(greyScaling?1:iLut);
|
||||
//guy_epdParam(greyScaling?1:iLut);
|
||||
guy_epdParam(greyScaling ? 1 : pgm_read_byte(VSH_repeat + iLut));
|
||||
for(i=0;i<83;i++) guy_epdParam(0);
|
||||
guy_epdParam(0x22);
|
||||
for(i=0;i<8;i++) guy_epdParam(0);
|
||||
@@ -160,6 +164,8 @@ void drvSSD168x::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单
|
||||
for(int i=0;i<10;i++) guy_epdParam(i==5?0x40:0x00);
|
||||
guy_epdCmd(0x3C); //BorderWavefrom
|
||||
guy_epdParam(0x80);
|
||||
guy_epdCmd(0x18); //BorderWavefrom
|
||||
guy_epdParam(0x80);
|
||||
|
||||
guy_epdCmd(0x22);
|
||||
guy_epdParam(0xC0);
|
||||
@@ -172,9 +178,10 @@ void drvSSD168x::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单
|
||||
epd_PowerOn=1;
|
||||
_part=0;
|
||||
iLut=15;
|
||||
guy_epdBusy(20);
|
||||
}
|
||||
guy_epdCmd(0x12); //SWRESET
|
||||
guy_epdBusy(10);
|
||||
guy_epdBusy(20);
|
||||
|
||||
guy_epdCmd(0x01); //Driver output control
|
||||
guy_epdParam((epdHeight-1)&0xff);
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
#include <FS.h>
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include "guy_epaper_config.h"
|
||||
#include "../guy_config_host.h"
|
||||
#include <functional>
|
||||
|
||||
#define FILL_WHITE ([](int)->uint8_t{return 0xff;})
|
||||
#define FILL_BLACK ([](int)->uint8_t{return 0x00;})
|
||||
|
||||
@@ -128,12 +128,16 @@ public:
|
||||
auto cfg = _bus_instance.config(); // 获取总线配置的结构。
|
||||
#ifndef ESP8266
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
cfg.spi_host = SPI3_HOST; // 选择要使用的 SPI (VSPI_HOST or HSPI_HOST)
|
||||
cfg.spi_host = VSPI_HOST; // 选择要使用的 SPI (VSPI_HOST or HSPI_HOST)
|
||||
#else
|
||||
cfg.spi_host = SPI1_HOST; // 选择要使用的 SPI (VSPI_HOST or HSPI_HOST)
|
||||
#endif
|
||||
cfg.use_lock = true; // 使用锁时设置为 True
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
|
||||
cfg.dma_channel = SPI_DMA_CH_AUTO; // Set the DMA channel (1 or 2. 0=disable) 设置要打开的 DMA 通道 (0=DMA关闭)
|
||||
#else
|
||||
cfg.dma_channel = 0; // Auto DMA channel isn't supported. Don't use DMA by default.
|
||||
#endif
|
||||
#endif
|
||||
cfg.spi_mode = 0; // SPI设置通讯模式 (0 ~ 3)
|
||||
#if (defined(DISPLAY_TYPE_ST7789_240320) || defined(DISPLAY_TYPE_ST7789_240240) || defined(DISPLAY_TYPE_ST7789_135240))
|
||||
|
||||
@@ -40,26 +40,10 @@
|
||||
//务必保证这些版本号是一致的.
|
||||
//另外, 在提交新版本之前, 不要忘记在github上创建release, 否则Arduino IDE会读不到
|
||||
#define READGUY_V_MAJOR 1
|
||||
#define READGUY_V_MINOR 4
|
||||
#define READGUY_V_PATCH 2
|
||||
#define READGUY_V_MINOR 5
|
||||
#define READGUY_V_PATCH 0
|
||||
#define READGUY_VERSION_VAL (READGUY_V_MAJOR*1000+READGUY_V_MINOR*100+READGUY_V_PATCH*10)
|
||||
#define READGUY_VERSION "1.4.2"
|
||||
|
||||
#ifdef ESP8266
|
||||
#define _READGUY_PLATFORM "ESP8266"
|
||||
#else
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define _READGUY_PLATFORM "ESP32"
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#define _READGUY_PLATFORM "ESP32S2"
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define _READGUY_PLATFORM "ESP32S3"
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#define _READGUY_PLATFORM "ESP32C3"
|
||||
#else
|
||||
#define _READGUY_PLATFORM "Unknown"
|
||||
#endif
|
||||
#endif
|
||||
#define READGUY_VERSION "1.5.0"
|
||||
|
||||
#define _GITHUB_LINK "https://github.com/fsender/readguy"
|
||||
#define _BILIBILI_LINK "https://www.bilibili.com/video/BV1f94y187wz"
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
|
||||
#include "readguy.h"
|
||||
#if (!defined(ESP8266)) //for ESP32, ESP32S2, ESP32S3, ESP32C3
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
|
||||
#include "esp_flash.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
static const PROGMEM char NOT_SUPPORTED[] = "(不支持此屏幕)";
|
||||
@@ -186,7 +188,7 @@ const char *ReadguyDriver::epd_drivers_list[EPD_DRIVERS_NUM_MAX]={
|
||||
//x==62 -> _
|
||||
//#define R2CHAR(x) (((x)==63)?42:(((x)==62)?95:(((x)>=36)?((x)+61):(((x)>=10)?((x)+55):((x)+48)))))
|
||||
void ReadguyDriver::ap_setup(){
|
||||
return ap_setup("readguy","12345678");
|
||||
return ap_setup(READGUY_CONF_AP_SSID,READGUY_CONF_AP_PASS);
|
||||
}
|
||||
void ReadguyDriver::ap_setup(const char *ssid, const char *pass, int m){
|
||||
//初始化WiFi AP模式, 用于将来的连接WiFi 处于已连接状态下会断开原本的连接
|
||||
@@ -203,7 +205,9 @@ void ReadguyDriver::ap_setup(const char *ssid, const char *pass, int m){
|
||||
void ReadguyDriver::server_setup(const String ¬ify, const serveFunc *serveFuncs, int funcs){
|
||||
//启动WiFi服务器端, 这样就可以进行配网工作
|
||||
if(sfuncs!=-1) server_end(); //避免重复服务器setup
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
httpUpdater.setup(&sv);
|
||||
#endif
|
||||
sv.on("/", HTTP_GET, std::bind(&ReadguyDriver::handleInit ,this));
|
||||
sv.on("/verify", HTTP_POST, std::bind(&ReadguyDriver::handleInitPost ,this)); //此时已经完成了引脚初始化
|
||||
sv.on("/pinsetup", HTTP_GET, std::bind(&ReadguyDriver::handlePinSetup ,this));
|
||||
@@ -231,17 +235,16 @@ void ReadguyDriver::server_setup(const String ¬ify, const serveFunc *serveFun
|
||||
}
|
||||
else { sfnames=nullptr; sfevents=nullptr; }
|
||||
|
||||
|
||||
/*sv.on("/favicon.ico", HTTP_GET, [&](){
|
||||
sv.client().write_P(PSTR("HTTP/1.1 200 OK\r\n"
|
||||
"Content-Type: image/x-icon\r\n"
|
||||
"Content-Length: 1150\r\n"
|
||||
"Connection: close\r\n\r\n"),89);
|
||||
sv.client().write_P((const char *)faviconData,sizeof(faviconData));
|
||||
});*/
|
||||
#ifdef READGUY_USE_DEFAULT_ICON
|
||||
sv.on("/favicon.ico", HTTP_GET, [&](){
|
||||
sv.send_P(200,"image/x-icon",(const char *)faviconData,sizeof(faviconData));
|
||||
});
|
||||
#endif
|
||||
sv.begin();
|
||||
MDNS.begin("readguy");
|
||||
//MDNS.addService("http","tcp",80);
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
MDNS.begin(READGUY_MDNS_SERVICE);
|
||||
MDNS.addService("http","tcp",80);
|
||||
#endif
|
||||
#ifdef READGUY_SERIAL_DEBUG
|
||||
Serial.print(F("[Guy server] Done! visit "));
|
||||
if(WiFi.getMode() == WIFI_AP) Serial.println(F("192.168.4.1"));
|
||||
@@ -288,7 +291,9 @@ bool ReadguyDriver::server_loop(){ //此时等待网页操作完成响应...
|
||||
}
|
||||
void ReadguyDriver::server_end(){
|
||||
sv.stop();
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
MDNS.end();
|
||||
#endif
|
||||
sfuncs=-1;
|
||||
delete [] sfnames;
|
||||
delete [] sfevents;
|
||||
@@ -318,11 +323,17 @@ void ReadguyDriver::handleInitPost(){
|
||||
btnTask.detach();
|
||||
#else
|
||||
#ifdef READGUY_ENABLE_SD
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
if(READGUY_shareSpi) SD.end(); else SD_MMC.end();
|
||||
#else
|
||||
SD.end();//关闭SD卡
|
||||
#endif
|
||||
#ifdef READGUY_IDF_TARGET_WITH_VSPI
|
||||
if(sd_spi != epd_spi) { //共线时, 不要删除SD
|
||||
delete sd_spi;
|
||||
sd_spi=nullptr;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
vTaskDelete(btn_handle);
|
||||
#endif
|
||||
@@ -353,7 +364,7 @@ void ReadguyDriver::handleInitPost(){
|
||||
else if(i==19&&btn_count_>2) config_data[17]=sv.arg(FPSTR(args_name[19])).toInt()+1;
|
||||
else if(i==20&&btn_count_>2) config_data[17]=-config_data[17];
|
||||
else if(i==21) config_data[18] = sv.arg(FPSTR(args_name[21])).toInt();
|
||||
else if(i==22) config_data[19] = sv.arg(FPSTR(args_name[22])).toInt(); //现已弃用 RTC 功能.
|
||||
else if(i==22) config_data[19] = sv.arg(FPSTR(args_name[22])).toInt(); //RTC 将在2.0实装
|
||||
else if(i>22){ //用户数据
|
||||
config_data[i-1] = sv.arg(a_name).toInt();
|
||||
}
|
||||
@@ -367,16 +378,16 @@ void ReadguyDriver::handleInitPost(){
|
||||
}
|
||||
}
|
||||
//尝试初始化各个硬件, 可能失败, 然后显示一些东西
|
||||
#if (defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C3))
|
||||
#if (defined(ESP8266))
|
||||
if(config_data[3]==-1) config_data[3] = config_data[10];
|
||||
else config_data[10] = config_data[3];
|
||||
if(config_data[4]==-1) config_data[4] = config_data[11];
|
||||
else config_data[11] = config_data[4];
|
||||
READGUY_shareSpi = true;
|
||||
#else
|
||||
if(config_data[10] == config_data[3] && config_data[11] == config_data[4]) //检测到SPI共线
|
||||
if(config_data[10] == config_data[3] || config_data[11] == config_data[4]) //检测到SPI共线
|
||||
READGUY_shareSpi = true;
|
||||
else if(READGUY_shareSpi){
|
||||
if(READGUY_shareSpi){
|
||||
if(config_data[3]==-1) config_data[3] = config_data[10];
|
||||
else config_data[10] = config_data[3];
|
||||
if(config_data[4]==-1) config_data[4] = config_data[11];
|
||||
@@ -423,6 +434,9 @@ void ReadguyDriver::handleInitPost(){
|
||||
Serial.println(F("[Guy] Init details..."));
|
||||
#endif
|
||||
setTextSize(1);
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
SD_MMC.end();
|
||||
#endif
|
||||
drawCenterString(setSDcardDriver()?"SD Init OK!":"SD Init failed!",
|
||||
guy_dev->drv_width()>>1,(guy_dev->drv_height()>>1)+20);
|
||||
setButtonDriver(); //初始化按钮..
|
||||
@@ -432,7 +446,7 @@ void ReadguyDriver::handleInitPost(){
|
||||
drawRect((guy_dev->drv_width()>>1)-46+48,(guy_dev->drv_height()>>1)-14,20,28,0);
|
||||
drawRect((guy_dev->drv_width()>>1)-46+72,(guy_dev->drv_height()>>1)-14,20,28,0);
|
||||
refresh_begin(0);
|
||||
guy_dev->drv_fullpart(1);
|
||||
guy_dev->drv_fullpart(0);
|
||||
guy_dev->_display((const uint8_t*)getBuffer());
|
||||
#if (defined(READGUY_ALLOW_DC_AS_BUTTON))
|
||||
refresh_end();
|
||||
@@ -574,10 +588,10 @@ void ReadguyDriver::handlePinSetup(){
|
||||
#else
|
||||
for(int i=0;i<12;i++){
|
||||
s += F("<br/>");
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#if (!(defined(READGUY_IDF_TARGET_WITH_VSPI) || defined(READGUY_IDF_TARGET_MATRIX_SDIO)))
|
||||
if(i==7) {
|
||||
i+=2; //优化ESP32C3的SPI配置体验 (C3只能共线)
|
||||
s += F("(ESP32C3不支持SD卡独立SPI总线! SD_MOSI和SD_SCLK沿用EPDMOSI和EPDSCLK)<br/>");
|
||||
s += F("(" _READGUY_PLATFORM "不支持SD卡独立SPI总线! SD_MOSI和SD_SCLK沿用EPDMOSI和EPDSCLK)<br/>");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -671,16 +685,32 @@ void ReadguyDriver::handleFinal(){
|
||||
else s+=F("SD卡已插入.<br/>"); //对于大容量(>2GB)卡, SDFS.info64(*sdInfo)函数调用速度太慢(17秒)
|
||||
#else
|
||||
else{
|
||||
auto cardType = SD.cardType();
|
||||
uint32_t sz;
|
||||
uint32_t usesz;
|
||||
sdcard_type_t cardType;
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
if(READGUY_shareSpi){
|
||||
#endif
|
||||
sz=(uint32_t)(SD.cardSize()/1024);
|
||||
usesz=(uint32_t)(SD.usedBytes()/1024);
|
||||
cardType=SD.cardType();
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
}
|
||||
else{
|
||||
sz=(uint32_t)(SD_MMC.cardSize()/1024);
|
||||
usesz=(uint32_t)(SD_MMC.usedBytes()/1024);
|
||||
cardType=SD_MMC.cardType();
|
||||
}
|
||||
#endif
|
||||
s+=F("SD Card Type: ");
|
||||
if(cardType == CARD_MMC) s+=F("MMC");
|
||||
else if(cardType == CARD_SD) s+=F("SDSC");
|
||||
else if(cardType == CARD_SDHC) s+=F("SDHC");
|
||||
else s+=F("UNKNOWN");
|
||||
s+=F(", SD card size: ");
|
||||
s+=(uint32_t)(SD.cardSize()/1024);
|
||||
s+=sz;
|
||||
s+=F(", used size: ");
|
||||
s+=(uint32_t)(SD.usedBytes()/1024);
|
||||
s+=usesz;
|
||||
s+=F("KB.<br/>");
|
||||
}
|
||||
#endif
|
||||
@@ -701,10 +731,17 @@ void ReadguyDriver::handleFinal(){
|
||||
char cbuf[20]="";
|
||||
#if (defined(ESP8266))
|
||||
sprintf(cbuf, "0x%08x", ESP.getChipId());
|
||||
#else
|
||||
#elif (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0))
|
||||
uint64_t gotID;
|
||||
esp_flash_read_unique_chip_id(esp_flash_default_chip,&gotID);
|
||||
sprintf(cbuf, "%016llx", gotID);
|
||||
//sprintf(cbuf, "%016llx", gotID);
|
||||
sprintf(cbuf, "%08x%08x",(unsigned int)(gotID>>32),(unsigned int)(gotID&0xffffffffu));
|
||||
#else
|
||||
uint32_t chipId = 0;
|
||||
for(int i=0; i<17; i=i+8) {
|
||||
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
|
||||
}
|
||||
sprintf(cbuf, "0x%08x",chipId);
|
||||
#endif
|
||||
s+=cbuf;
|
||||
s+=F("<br/>闪存容量: ");
|
||||
@@ -770,7 +807,7 @@ const PROGMEM char ReadguyDriver::index_cn_html[] = // then write EpdMOSI pin
|
||||
"将引脚配置输入到框内, 即可成功点亮屏幕.</p><hr/><h2>引脚定义设定</h2><form "
|
||||
"name=\"input\" action=\"/verify\" method=\"POST\">";
|
||||
const PROGMEM char ReadguyDriver::index_cn_html2[] =
|
||||
#if (!defined(ESP8266) && !defined(CONFIG_IDF_TARGET_ESP32C3))
|
||||
#if (defined(READGUY_IDF_TARGET_WITH_VSPI) || defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
"<input type=\"checkbox\" name=\"share\" value=\"1\">墨水屏和SD卡共享SPI<br/>"
|
||||
#endif
|
||||
"E-paper 型号<select id=\"et\" onchange=\"ct()\" name=\"epdtype\">";
|
||||
@@ -784,14 +821,18 @@ const PROGMEM char ReadguyDriver::verify_html[] =
|
||||
const PROGMEM char ReadguyDriver::verify2_html[] =
|
||||
"<br/><hr/>完成上述4个操作之后屏幕上将会展现出验证码,输入验证码即可完成硬件配置.<br/></p><form action=\"/fin"
|
||||
"al\" method=\"POST\"><input type=\'text\' name=\'t_verify\' maxlength=\"6";
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html[3][224] = {
|
||||
const PROGMEM char *ReadguyDriver::verifybtn_html[3] = {verifybtn_html1,verifybtn_html2,verifybtn_html3};
|
||||
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html1[] =
|
||||
"一个按键, 功能全保留, 操作可能比较繁琐.<br/>点按:下一个/向下翻页<br/>双击:确定/选择<br/>三连击:返回/退格<br/>"
|
||||
"长按半秒:上一个/向上翻页<br/>点按紧接着长按: 特殊操作",
|
||||
"长按半秒:上一个/向上翻页<br/>点按紧接着长按: 特殊操作";
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html2[] =
|
||||
"两个按键, 操作可以满足需求.<br/>按键1点按:下一个/向下翻页<br/>按键1长按:上一个/向上翻页<br/>按键2点按:确定/选"
|
||||
"择<br/>按键2长按:返回/退格<br/>按住按键1点按2:特殊操作",
|
||||
"择<br/>按键2长按:返回/退格<br/>按住按键1点按2:特殊操作";
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html3[] =
|
||||
"三个按键, 操作非常方便流畅.<br/>按键1:上一个/向上翻页<br/>按键2点按:确定/选择<br/>按键2长按: 返回/退格<br/>按"
|
||||
"键3:下一个/向下翻页<br/>双击点按2:切换输入法等特殊操作"
|
||||
};
|
||||
"键3:下一个/向下翻页<br/>双击点按2:切换输入法等特殊操作";
|
||||
|
||||
const PROGMEM char ReadguyDriver::final_html[] =
|
||||
"欢迎使用 readguy</title></head><body><h1>readguy ";
|
||||
const PROGMEM char ReadguyDriver::afterConfig_html[] =
|
||||
@@ -807,10 +848,14 @@ const PROGMEM char ReadguyDriver::final2_html[] =
|
||||
"钥<input type=\'text\' name=\'psk\' maxlength=\"63";
|
||||
*/
|
||||
const PROGMEM char ReadguyDriver::end_html[] =
|
||||
"<p>ReadGuy on device " _READGUY_PLATFORM " <a href=\"/pinsetup\">重新配置引脚</a> <a href=\"/update\">固件更新"
|
||||
"</a><br/>Copyright © FriendshipEnder <a href=\"" _GITHUB_LINK "\">GitHub</a> <a href=\"" _BILIBILI_LINK "\">"
|
||||
"<p>ReadGuy on device " _READGUY_PLATFORM " <a href=\"/pinsetup\">重新配置引脚</a>"
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
" <a href=\"/update\">" READGUY_UPDATE_SERVER "</a>"
|
||||
#endif
|
||||
"<br/>Copyright © FriendshipEnder <a href=\"" _GITHUB_LINK "\">GitHub</a> <a href=\"" _BILIBILI_LINK "\">"
|
||||
"Bilibili</a><br/>版本: " READGUY_VERSION " ,编译日期: " __DATE__ " " __TIME__ "</p></body></html>";
|
||||
/*const PROGMEM uint8_t ReadguyDriver::faviconData[1150]={
|
||||
#ifdef READGUY_USE_DEFAULT_ICON
|
||||
const PROGMEM uint8_t ReadguyDriver::faviconData[1150]={
|
||||
0x0,0x0,0x1,0x0,0x1,0x0,0x10,0x10,0x0,0x0,0x1,0x0,0x20,0x0,0x68,0x4,0x0,0x0,0x16,0x0,0x0,0x0,0x28,0x0,
|
||||
0x0,0x0,0x10,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x1,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x40,0x4,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9d,0xaa,0xe8,0xff,0x74,0x73,0x77,0xff,0x74,0x73,
|
||||
@@ -859,6 +904,7 @@ const PROGMEM char ReadguyDriver::end_html[] =
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
|
||||
0x0,0x0,0x0,0x1,0x0,0x0,0x80,0x1,0x0,0x0,0x80,0x0,0x0,0x0,0x80,0x1,0x0,0x0,0x80,0x1,0x0,0x0,0xc0,0x1,
|
||||
0x0,0x0,0xc0,0x3,0x0,0x0,0xe0,0x3,0x0,0x0,0xf0,0x7,0x0,0x0,0xfc,0x1f,0x0,0x0,0xf0,0xff,0x0,0x0
|
||||
};*/
|
||||
};
|
||||
#endif
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||
2111
src/readguy.cpp
157
src/readguy.h
@@ -35,6 +35,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
@@ -91,7 +92,7 @@
|
||||
|
||||
#include "guy_button.h" //改自Button2精简而来
|
||||
#include "guy_version.h"
|
||||
#include "guy_driver_config.h" //config
|
||||
#include "guy_config_host.h" //config
|
||||
#ifdef READGUY_USE_LITTLEFS
|
||||
#include <LittleFS.h>
|
||||
#else
|
||||
@@ -105,9 +106,13 @@
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
#include "ESP8266HTTPUpdateServer.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef READGUY_ENABLE_SD
|
||||
#include <SDFS.h>
|
||||
#endif
|
||||
@@ -117,10 +122,17 @@
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
#include <WiFi.h>
|
||||
#include <WebServer.h>
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
#include <ESPmDNS.h>
|
||||
#endif
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
#include "HTTPUpdateServer.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef READGUY_ENABLE_SD
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
#include <SD_MMC.h>
|
||||
#endif
|
||||
#include <SD.h>
|
||||
#endif
|
||||
#include <freertos/FreeRTOS.h>
|
||||
@@ -151,7 +163,7 @@
|
||||
#define READGUY_btn2 (config_data[16])
|
||||
#define READGUY_btn3 (config_data[17])
|
||||
#define READGUY_bl_pin (config_data[18])//前置光接口引脚IO
|
||||
#define READGUY_rtc_type (config_data[19])//现已弃用 RTC 功能. 保留是为了兼容性 让代码更简单维护
|
||||
#define READGUY_rtc_type (config_data[19])//RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
#define READGUY_sd_ok (config_data[20]) //SD卡已经成功初始化
|
||||
#define READGUY_buttons (config_data[21]) //按钮个数, 0-3都有可能
|
||||
|
||||
@@ -184,15 +196,38 @@
|
||||
#define GUY_BTN_OK 4 //返回/退出
|
||||
#define GUY_BTN_BACK 8 //特殊操作(如切换输入法)
|
||||
|
||||
#if __cplusplus >= 201304L
|
||||
#define RG_IL_CONEXP constexpr inline
|
||||
#else
|
||||
#define RG_IL_CONEXP inline
|
||||
#endif
|
||||
|
||||
enum ReadguyButtonGesture: uint8_t{
|
||||
guyBNone =0,
|
||||
guyBNext =1,
|
||||
guyBRight =1,
|
||||
guyBPrev =2,
|
||||
guyBLeft =2,
|
||||
guyBSelect =4,
|
||||
guyBOK =4,
|
||||
guyBCancel =8,
|
||||
guyBBack =8,
|
||||
guyBSpecial =16
|
||||
};
|
||||
|
||||
class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
public:
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
#ifdef ESP8266
|
||||
typedef ESP8266WebServer ReadguyWebServer;
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
typedef ESP8266HTTPUpdateServer ReadguyUpdateServer;
|
||||
#endif
|
||||
#else
|
||||
typedef WebServer ReadguyWebServer;
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
typedef HTTPUpdateServer ReadguyUpdateServer;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
ReadguyDriver();
|
||||
@@ -316,7 +351,7 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
bool SDinside(bool check=true) { return check?setSDcardDriver():READGUY_sd_ok; };
|
||||
void SDdeinit() { READGUY_sd_ok = 0; }; //当SD卡被检测到拔出或不可用时, 调用此函数标记
|
||||
/// @brief 检查按钮. 当配置未完成时,按钮不可用, 返回0.
|
||||
uint8_t getBtn() { return (READGUY_cali==127)?getBtn_impl():0; }
|
||||
ReadguyButtonGesture getBtn() { return (READGUY_cali==127)?(ReadguyButtonGesture)getBtn_impl():guyBNone; }
|
||||
/// @brief [此函数已弃用 非常不建议使用] 根据按钮ID来检查按钮. 注意这里如果按下返回0, 没按下或者按钮无效返回1
|
||||
//uint8_t getBtn(int btnID){return btnID<getButtonsCount()?(!(btn_rd[btnID].isPressedRaw())):1;}
|
||||
/// @brief 该函数用于设置按键是否允许扫描连按
|
||||
@@ -361,7 +396,7 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
//以下是支持的所有屏幕型号 Add devices here!
|
||||
//添加屏幕驱动范例: 直接添加对应屏幕的类就可以用了
|
||||
static const char projname[8];
|
||||
static const char tagname[7];
|
||||
static const char tagname[8];
|
||||
//uint8_t config_wifi=0; //是否强行在初始化期间设置WiFi.
|
||||
void nvs_init(); //初始化持久存储器.
|
||||
void nvs_deinit();//保存持久存储器的内容
|
||||
@@ -404,7 +439,9 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
#endif
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
ReadguyWebServer sv;
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
ReadguyUpdateServer httpUpdater;
|
||||
#endif
|
||||
String guy_notify=emptyString; //嵌入在网页中的自定义标语
|
||||
int sfuncs=-1;
|
||||
String* sfnames=nullptr;
|
||||
@@ -444,12 +481,17 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
static const PROGMEM char index_cn_html16[];
|
||||
static const PROGMEM char verify_html[];
|
||||
static const PROGMEM char verify2_html[];
|
||||
static const PROGMEM char verifybtn_html[3][224];
|
||||
static const PROGMEM char *verifybtn_html[3];
|
||||
static const PROGMEM char verifybtn_html1[];
|
||||
static const PROGMEM char verifybtn_html2[];
|
||||
static const PROGMEM char verifybtn_html3[];
|
||||
static const PROGMEM char final_html[];
|
||||
static const PROGMEM char afterConfig_html[];
|
||||
static const PROGMEM char home_html[];
|
||||
static const PROGMEM char end_html[];
|
||||
//static const PROGMEM uint8_t faviconData[1150];
|
||||
#ifdef READGUY_USE_DEFAULT_ICON
|
||||
static const PROGMEM uint8_t faviconData[1150];
|
||||
#endif
|
||||
#endif
|
||||
static void looptask(); //按键服务函数
|
||||
static uint8_t rd_btn_f(uint8_t btn, bool activeLow);
|
||||
@@ -465,10 +507,10 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
#else
|
||||
epd_spi->beginTransaction(SPISettings(ESP32_DISP_FREQUENCY, MSBFIRST, SPI_MODE0));
|
||||
#endif
|
||||
spibz ++;
|
||||
spibz +=1;
|
||||
}
|
||||
static void in_release(){//SPI结束传输屏幕数据
|
||||
spibz --;
|
||||
spibz -=1;
|
||||
#if (defined(READGUY_ALLOW_DC_AS_BUTTON))
|
||||
if(!(spibz&0x3f))
|
||||
#else
|
||||
@@ -481,67 +523,67 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
#endif
|
||||
}
|
||||
public: //增加了一些返回系统状态变量的函数, 它们是静态的, 而且不会对程序造成任何影响.
|
||||
constexpr int getShareSpi() const { return READGUY_shareSpi; }
|
||||
constexpr int getEpdType () const { return READGUY_epd_type; } // 对应的epd驱动程序代号, -1为未指定
|
||||
RG_IL_CONEXP int getShareSpi() const { return READGUY_shareSpi; }
|
||||
RG_IL_CONEXP int getEpdType () const { return READGUY_epd_type; } // 对应的epd驱动程序代号, -1为未指定
|
||||
//显示驱动部分, 显示默认使用vspi (vspi也是默认SPI库的通道)
|
||||
constexpr int getEpdMosi () const { return READGUY_epd_mosi; } // 目标显示器的 MOSI 引脚
|
||||
constexpr int getEpdSclk () const { return READGUY_epd_sclk; } // 目标显示器的 SCLK 引脚
|
||||
constexpr int getEpdCs () const { return READGUY_epd_cs; } // 目标显示器的 CS 引脚
|
||||
constexpr int getEpdDc () const { return READGUY_epd_dc; } // 目标显示器的 DC 引脚
|
||||
constexpr int getEpdRst () const { return READGUY_epd_rst; } // 目标显示器的 RST 引脚
|
||||
constexpr int getEpdBusy () const { return READGUY_epd_busy; } // 目标显示器的 BUSY 引脚
|
||||
RG_IL_CONEXP int getEpdMosi () const { return READGUY_epd_mosi; } // 目标显示器的 MOSI 引脚
|
||||
RG_IL_CONEXP int getEpdSclk () const { return READGUY_epd_sclk; } // 目标显示器的 SCLK 引脚
|
||||
RG_IL_CONEXP int getEpdCs () const { return READGUY_epd_cs; } // 目标显示器的 CS 引脚
|
||||
RG_IL_CONEXP int getEpdDc () const { return READGUY_epd_dc; } // 目标显示器的 DC 引脚
|
||||
RG_IL_CONEXP int getEpdRst () const { return READGUY_epd_rst; } // 目标显示器的 RST 引脚
|
||||
RG_IL_CONEXP int getEpdBusy () const { return READGUY_epd_busy; } // 目标显示器的 BUSY 引脚
|
||||
//sd卡驱动部分, 默认使用hspi (sd卡建议用hspi)
|
||||
constexpr int getSdMiso () const { return READGUY_sd_miso; } // 目标sd卡的 MISO 引脚, sd_share_spi == 1 时无效
|
||||
constexpr int getSdMosi () const { return READGUY_sd_mosi; }// 目标sd卡的 MOSI 引脚, sd_share_spi == 1 时无效
|
||||
constexpr int getSdSclk () const { return READGUY_sd_sclk; }// 目标sd卡的 SCLK 引脚, sd_share_spi == 1 时无效
|
||||
constexpr int getSdCs () const { return READGUY_sd_cs; }// 目标sd卡的CS引脚. 对ESP32S3, 返回127代表使用SDMMC
|
||||
constexpr int getI2cSda () const { return READGUY_i2c_sda; }// 目标i2c总线的SDA引脚, 当且仅当启用i2c总线时才生效
|
||||
constexpr int getI2cScl () const { return READGUY_i2c_scl; }// 目标i2c总线的SCL引脚, 当且仅当启用i2c总线时才生效
|
||||
RG_IL_CONEXP int getSdMiso () const { return READGUY_sd_miso; } // 目标sd卡的 MISO 引脚, sd_share_spi == 1 时无效
|
||||
RG_IL_CONEXP int getSdMosi () const { return READGUY_sd_mosi; }// 目标sd卡的 MOSI 引脚, sd_share_spi == 1 时无效
|
||||
RG_IL_CONEXP int getSdSclk () const { return READGUY_sd_sclk; }// 目标sd卡的 SCLK 引脚, sd_share_spi == 1 时无效
|
||||
RG_IL_CONEXP int getSdCs () const { return READGUY_sd_cs; }// 目标sd卡的CS引脚. 对ESP32S3, 返回127代表使用SDMMC
|
||||
RG_IL_CONEXP int getI2cSda () const { return READGUY_i2c_sda; }// 目标i2c总线的SDA引脚, 当且仅当启用i2c总线时才生效
|
||||
RG_IL_CONEXP int getI2cScl () const { return READGUY_i2c_scl; }// 目标i2c总线的SCL引脚, 当且仅当启用i2c总线时才生效
|
||||
//按键驱动部分, 为负代表高触发, 否则低触发,
|
||||
//注意, 这里的io编号是加1的, 即 1或-1 代表 gpio0 的低触发/高触发
|
||||
constexpr int getBtn1Pin () const { return abs((int)READGUY_btn1)-1; }
|
||||
constexpr int getBtn2Pin () const { return abs((int)READGUY_btn2)-1; }
|
||||
constexpr int getBtn3Pin () const { return abs((int)READGUY_btn3)-1; }
|
||||
constexpr int getBtn1Info() const { return READGUY_btn1; }
|
||||
constexpr int getBtn2Info() const { return READGUY_btn2; }
|
||||
constexpr int getBtn3Info() const { return READGUY_btn3; }
|
||||
constexpr int getBlPin () const { return READGUY_bl_pin; } //前置光接口引脚IO
|
||||
constexpr int getRtcType () const { return READGUY_rtc_type; } //现已弃用 RTC 功能. 保留是为了兼容性 让代码更简单维护
|
||||
constexpr int getButtonsCount() const { return READGUY_buttons; } //按钮个数, 0-3都有可能
|
||||
constexpr int getReadguy_user1 () const { return READGUY_user1; } //用户变量
|
||||
constexpr int getReadguy_user2 () const { return READGUY_user2; } //用户变量
|
||||
constexpr int getReadguy_user3 () const { return READGUY_user3; } //用户变量
|
||||
constexpr int getReadguy_user4 () const { return READGUY_user4; } //用户变量
|
||||
constexpr int getReadguy_user5 () const { return READGUY_user5; } //用户变量
|
||||
constexpr int getReadguy_user6 () const { return READGUY_user6; } //用户变量
|
||||
constexpr int getReadguy_user7 () const { return READGUY_user7; } //用户变量
|
||||
constexpr int getReadguy_user8 () const { return READGUY_user8; } //用户变量
|
||||
constexpr int getReadguy_user9 () const { return READGUY_user9; } //用户变量
|
||||
constexpr int getReadguy_user10() const { return READGUY_user10;} //用户变量
|
||||
constexpr int getReadguyUseSdio() const { //返回程序调用SD卡时 是否使用了SDIO
|
||||
RG_IL_CONEXP int getBtn1Pin () const { return abs((int)READGUY_btn1)-1; }
|
||||
RG_IL_CONEXP int getBtn2Pin () const { return abs((int)READGUY_btn2)-1; }
|
||||
RG_IL_CONEXP int getBtn3Pin () const { return abs((int)READGUY_btn3)-1; }
|
||||
RG_IL_CONEXP int getBtn1Info() const { return READGUY_btn1; }
|
||||
RG_IL_CONEXP int getBtn2Info() const { return READGUY_btn2; }
|
||||
RG_IL_CONEXP int getBtn3Info() const { return READGUY_btn3; }
|
||||
RG_IL_CONEXP int getBlPin () const { return READGUY_bl_pin; } //前置光接口引脚IO
|
||||
RG_IL_CONEXP int getRtcType () const { return READGUY_rtc_type; } //RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
RG_IL_CONEXP int getButtonsCount() const { return READGUY_buttons; } //按钮个数, 0-3都有可能
|
||||
RG_IL_CONEXP int getReadguy_user1 () const { return READGUY_user1; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user2 () const { return READGUY_user2; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user3 () const { return READGUY_user3; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user4 () const { return READGUY_user4; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user5 () const { return READGUY_user5; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user6 () const { return READGUY_user6; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user7 () const { return READGUY_user7; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user8 () const { return READGUY_user8; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user9 () const { return READGUY_user9; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user10() const { return READGUY_user10;} //用户变量
|
||||
RG_IL_CONEXP bool getReadguyUseSdio() const { //返回程序调用SD卡时 是否使用了SDIO
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3 //仅对ESP32S3可用
|
||||
return (READGUY_user1 != -1) && (READGUY_user2 != -1);
|
||||
return (READGUY_user1 != -1) && (READGUY_user2 != -1) && (READGUY_sd_cs != -1);
|
||||
#else
|
||||
return 0; //非ESP32S3平台不可用SDIO
|
||||
#endif
|
||||
} //用于esp32s3使用SDIO卡数据的DAT2
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3 //仅对ESP32S3可用
|
||||
constexpr int getSdio_dat0 () const { return getReadguyUseSdio()?READGUY_sd_miso:-1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
constexpr int getSdio_dat1 () const { return getReadguyUseSdio()?READGUY_user1 :-1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
constexpr int getSdio_dat2 () const { return getReadguyUseSdio()?READGUY_user2 :-1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
constexpr int getSdio_dat3 () const { return getReadguyUseSdio()?READGUY_sd_cs :-1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
constexpr int getSdio_clk () const { return getReadguyUseSdio()?READGUY_sd_sclk:-1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
constexpr int getSdio_cmd () const { return getReadguyUseSdio()?READGUY_sd_mosi:-1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
RG_IL_CONEXP int getSdio_dat0 () const { return getReadguyUseSdio()?READGUY_sd_miso:-1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
RG_IL_CONEXP int getSdio_dat1 () const { return getReadguyUseSdio()?READGUY_user1 :-1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
RG_IL_CONEXP int getSdio_dat2 () const { return getReadguyUseSdio()?READGUY_user2 :-1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
RG_IL_CONEXP int getSdio_dat3 () const { return getReadguyUseSdio()?READGUY_sd_cs :-1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
RG_IL_CONEXP int getSdio_clk () const { return getReadguyUseSdio()?READGUY_sd_sclk:-1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
RG_IL_CONEXP int getSdio_cmd () const { return getReadguyUseSdio()?READGUY_sd_mosi:-1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
#else
|
||||
constexpr int getSdio_dat0 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
constexpr int getSdio_dat1 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
constexpr int getSdio_dat2 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
constexpr int getSdio_dat3 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
constexpr int getSdio_clk () const { return -1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
constexpr int getSdio_cmd () const { return -1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
RG_IL_CONEXP int getSdio_dat0 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
RG_IL_CONEXP int getSdio_dat1 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
RG_IL_CONEXP int getSdio_dat2 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
RG_IL_CONEXP int getSdio_dat3 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
RG_IL_CONEXP int getSdio_clk () const { return -1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
RG_IL_CONEXP int getSdio_cmd () const { return -1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
#endif
|
||||
//constexpr int memWidth () const { return guy_width ; } //返回显存宽度(不是画幅宽度),不会随着画布旋转改变
|
||||
//constexpr int memHeight () const { return guy_height ; } //返回显存高度(不是画幅高度),不会随着画布旋转改变
|
||||
//RG_IL_CONEXP int memWidth () const { return guy_width ; } //返回显存宽度(不是画幅宽度),不会随着画布旋转改变
|
||||
//RG_IL_CONEXP int memHeight () const { return guy_height ; } //返回显存高度(不是画幅高度),不会随着画布旋转改变
|
||||
int drvWidth () const { return READGUY_cali==127?guy_dev->drv_width():0; } //返回显示屏硬件宽度(不是画幅宽度)
|
||||
int drvHeight() const { return READGUY_cali==127?guy_dev->drv_height():0; } //返回显示屏硬件高度(不是画幅高度)
|
||||
//int width () const { return (getRotation()&1)?drvHeight():drvWidth(); }
|
||||
@@ -562,5 +604,6 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
void drawImageStage(LGFX_Sprite &sprbase,LGFX_Sprite &spr,int32_t x,int32_t y,
|
||||
uint8_t stage,uint8_t totalstage,int32_t zoomw=0,int32_t zoomh=0);
|
||||
};
|
||||
#undef RG_IL_CONEXP
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||