v1.0.2; change file structure

This commit is contained in:
fsender
2023-09-24 16:59:01 +08:00
parent 5f91e9a9a5
commit 765c433e53
59 changed files with 9077 additions and 632 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
extra/artset/reward.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
extra/artset/test.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
extra/artset/test1bit.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
extra/artset/test24bit.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

BIN
extra/artset/test32bit.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 KiB

BIN
extra/artset/view.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

View File

@@ -1,18 +0,0 @@
/**
* @file main.cpp
* @author ex01_helloWorld
* @brief 基础的实例. 同时注入了少许功能性驱动代码.
* http://www.lilygo.cn/prod_view.aspx?TypeId=50036&Id=1318
* 项目基于 TTGO T-block Ep-bk (带有背光功能的ESP32电子墨水屏模块)
*
* 注意屏幕所用的 EPD_RESET 其实是接在 GPIO38 上面, 手册写的 GPIO34 是错误的
* GPIO38 为 SENSOR_CAPN 引脚(可能是供内部使用),
* 在标准的 ESP32-WROOM 和 WROVER 模组上未引出此 GPIO.
* 可能影响一部分功能的正常使用. 不过无伤大雅
*
* @version 0.1
* @date 2022-11-23
*
* @copyright Copyright (c) 2022
*
*/

View File

@@ -1,143 +0,0 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
*
* @file oldDemo/main.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @version 1.0
* @date 2023-09-19
* @brief 旧版的功能演示.
* 将根目录下的data文件夹 上传到LittleFS之后运行效果更佳
* 或者可以准备一张SD卡,并准备在卡的根目录下放置data文件夹内的文件.
* 用于演示BMP格式图片灰度显示.
*
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <Arduino.h>
#include "guy_driver.h"
const char HelloArduino[] = "Hello Arduino!";
const char HelloEpaper[] = "Hello E-Paper!";
readguy_driver guy;
void helloWorld(int i,int j)
{
bool full=1;
if(i>=1000){
i-=1000;
full=0;
}
Serial.printf("[%lu] helloWorld: %d, %d\n",millis(),i,j);
guy.setFont(&FreeMonoBold9pt7b);
guy.setTextColor(0,1);
//display.fillScreen(GxEPD_WHITE);
guy.setCursor(i,j);
guy.print("Hello");
if(!full) guy.print("Full");
//guy.g().drawString(HelloWorld,i,j);
guy.display(full); // full update
Serial.printf("[%lu] helloWorld done\n",millis());
}
//TaskHandle_t press2reset_h=nullptr;
void press2reset_f(void *pv){
pinMode(36,INPUT_PULLUP);
for(;;){
if(!digitalRead(36)) ESP.restart();
delay(10);
}
}
void setup()
{
Serial.begin(115200);
Serial.println("setup");
//xTaskCreate(press2reset_f,"press2reset",1024,nullptr,1,&press2reset_h);
guy.init();
//pinMode(32,INPUT);
delay(100);
// first update should be full refresh
helloWorld(10,10);
helloWorld(10,30);
LGFX_Sprite sp(&guy);
sp.createFromBmpFile(guy.guyFS(),"/test.bmp");
Serial.printf("sp.w: %d, h: %d, res: %d.\n",sp.width(),sp.height(),ESP.getFreeHeap());
guy.drawImage(sp,30,10);
Serial.printf("drawn dithering bmp.\n");
delay(2500);
guy.draw16grey(sp,30,10);
Serial.printf("drawn.\n");
delay(5000);
guy.fillScreen(1);
helloWorld(1010,50);
helloWorld(10,70);
guy.fillScreen(1);
helloWorld(10,90);
guy.fillScreen(1);
helloWorld(10,140);
guy.fillScreen(1);
guy.drawChar(10,40,'a',true,false,2);
helloWorld(10,160);
helloWorld(1010,10);
helloWorld(1040,30);
guy.sleepEPD();
delay(2000);
helloWorld(1010,50);
helloWorld(20,70);
helloWorld(30,90);
guy.fillScreen(1);
helloWorld(40,110);
guy.setDepth(10); //设置颜色深度
helloWorld(38,126);
guy.setDepth(6);
helloWorld(36,142);
guy.setDepth(2);
helloWorld(38,158);
guy.setDepth(0); //恢复正常颜色深度
guy.fillScreen(1);
guy.display(0); //慢刷清屏
guy.setFont(&fonts::Font0);
for(int i=1;i<16;i++){
guy.setDepth(i); //灰度测试
guy.fillRect(10,i*10,20,10,0);
guy.setCursor(32,i*10);
guy.printf("Grey%d",i);
guy.display();
}
delay(3000);
guy.fillScreen(0);
guy.display();
guy.drawLine(0,0,guy.width(),guy.height(),1);
guy.display();
Serial.println("Reading touch sensor...");
//guy.ap_setup();
//guy.server_setup();
}
int bright=128;
void loop(){
//guy.server_loop();
delay(10);
if(bright%7==0){
Serial.printf("getBtn: %d\n",guy.getBtn());
}
if(bright==511) bright=0;
else bright++;
guy.setBright(bright>=256?511-bright:bright);
}

View File

@@ -0,0 +1,158 @@
;/******************** F r i e n d s h i p E n d e r ********************
; * 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
; * 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
; * 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
; * 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
; *
; * @file platformio.ini
; * @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
; * @version 1.0
; * @date 2023-09-18
; * @brief platformIO项目基础控制文件.
; *
; * @attention
; * Copyright (c) 2022-2023 FriendshipEnder
; *
; * Apache License, Version 2.0
; *
; * Licensed under the Apache License, Version 2.0 (the "License");
; * you may not use this file except in compliance with the License.
; * You may obtain a copy of the License at
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an "AS IS" BASIS,
; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
;*/
;更改此处来实现ESP32和ESP8266两个版本的编译
;default_envs = esp32dev - ESP32环境
;default_envs = nodemcuv2 - esp8266环境
;default_envs = esp32s3_2m - ESP32S3 2MB PSRAM环境
;default_envs = esp32s3_8m - ESP32S3 8MB PSRAM环境
;default_envs = esp32c3_luatos - ESP32C3环境
;default_envs = esp32s2_dev - ESP32S2环境(我这边只有ESP32S2-Solo, 测试可以编译)
[platformio]
default_envs = nodemcuv2
;lib_deps =
;lovyan03/LovyanGFX
[env]
board_build.filesystem = littlefs ; SPIFFS mode
upload_speed = 921600 ; If using USB-JTAG, this selection is dummy
monitor_speed = 115200
build_flags =
-Wall
-Wextra
[env:esp32dev] ; 适用于ESP32的项目配置方案 注意是经典的ESP32...
platform = espressif32
board = esp32dev
board_build.f_cpu = 240000000L
board_build.f_flash = 80000000L
board_build.flash_mode = dio
board_build.partitions = readguy_4MB.csv ; defined
framework = espidf, arduino
monitor_filters = esp32_exception_decoder
;build_type = debug
build_flags =
; -DCORE_DEBUG_LEVEL=4
[env:nodemcuv2] ; 适用于ESP8266的项目配置方案
platform = espressif8266
board = nodemcuv2
framework = arduino
board_build.f_cpu = 160000000L
board_build.ldscript = eagle.flash.4m2m.ld
monitor_filters = esp8266_exception_decoder
;build_type = debug
build_flags =
; -DNON32XFER_HANDLER ;不需要PROGMEM保留字也可以访问flash中的内容
; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ;增大可用的HEAP内存
; -fstack-protector ;打开栈溢出保护器
[env:esp32s3_2m] ;适用于ESP32S3:2MB PSRAM 的项目配置方案. for ESP32S3 NxR2 series
; 圆屏, 适用于 flash 任意, PSRAM 2MB 的场景. 范例用的分区表是4M 的
; PSRAM 必须在menuconfig 里改
platform = espressif32
board = esp32-s3-devkitc-1
framework = espidf, arduino
board_build.f_cpu = 240000000L
board_build.f_flash = 80000000L
board_build.flash_mode = dio ; Running flash config is QIO
board_build.partitions = readguy_4MB.csv ; defined
monitor_filters = esp32_exception_decoder
;build_type = debug
build_flags =
;-DARDUINO_USB_MODE=1
;-DARDUINO_USB_CDC_ON_BOOT=1 ; 是否需要使用USB串口调试如果需要调试则打开否则禁用
; 如果打开了这个选项但是不连接串口在有串口输出的地方会卡顿1秒左右
-DBOARD_HAS_PSRAM=1 ;是否使用PSRAM
-DPSRAM_SIZE_KB=2048
; -DARDUINO_RUNNING_CORE=1
; -DARDUINO_EVENT_RUNNING_CORE=1
; -Werror
;lib_deps_builtin =
; SPI
; littlefs
; SD_MMC
[env:esp32s3_8m] ;适用于ESP32S3:8MB PSRAM 的项目配置方案. for ESP32S3 NxR8 series
; 方屏, 适用于 flash 任意, PSRAM 8MB 的场景. 范例用的分区表是 8M 的
; PSRAM 必须在menuconfig 里改
platform = espressif32
board = lolin_s3
framework = espidf, arduino
board_build.f_cpu = 240000000L
board_build.f_flash = 80000000L
board_build.flash_mode = dio
board_build.partitions = readguy_16MB.csv
monitor_filters = esp32_exception_decoder
build_flags =
;-DARDUINO_USB_MODE=1
;-DARDUINO_USB_CDC_ON_BOOT=1 ; 是否需要使用USB串口调试如果需要调试则打开否则禁用
; 如果打开了这个选项但是不连接串口在有串口输出的地方会卡顿1秒左右
-DBOARD_HAS_PSRAM=1 ;是否使用PSRAM
-DPSRAM_SIZE_KB=8192
; -DARDUINO_RUNNING_CORE=1
; -DARDUINO_EVENT_RUNNING_CORE=1
;lib_deps_builtin =
; SPI
; littlefs
; SD_MMC
[env:esp32c3_luatos] ;适用于ESP32C3 的项目配置方案.
platform = espressif32 ;注意在使用不带串口芯片的ESP32C3时, 尽量不要使用引脚18和19.
board = esp32-c3-devkitm-1 ;那俩是连接的板载USB串口 (USB-CDC, 可以下载程序或是当免驱串口)
framework = espidf, arduino ;合宙你真该死啊出这种没串口芯片的ESP32C3 甚至旧版本arduino无法编程!
board_build.f_cpu = 160000000L ;芯片速率默认160MHz, 不支持高频240MHz.
;board_build.flash_size=2MB ;2MB的芯片就选readguy_2MB_noOTA.csv
board_build.flash_size=4MB ;根据你自己的改, 不得小于4MB. 2MB的芯片就选readguy_2MB_noOTA.csv
board_build.f_flash = 80000000L
board_build.flash_mode = dio
board_build.partitions = readguy_4MB.csv ; 2MB的芯片就选readguy_2MB_noOTA.csv
build_flags =
-DCORE_DEBUG_LEVEL=1 ; None 0, Error 1, Warn 2, Info 3, Debug 4, Verbose 5
[env:esp32s2_dev] ;适用于ESP32S2 的项目配置方案.
platform = espressif32
board = nodemcu-32s2
framework = espidf, arduino
board_build.f_cpu = 240000000L
board_build.flash_size=4MB ;根据你自己的改, 不得小于4MB
board_build.f_flash = 80000000L
board_build.flash_mode = dio
board_build.partitions = readguy_4MB.csv ; defined
build_flags =
-DCORE_DEBUG_LEVEL=1 ; None 0, Error 1, Warn 2, Info 3, Debug 4, Verbose 5

View File

@@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x640000,
app1, app, ota_1, 0x650000,0x640000,
spiffs, data, spiffs, 0xc90000,0x360000,
coredump, data, coredump,0xFF0000,0x10000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x640000
5 app1 app ota_1 0x650000 0x640000
6 spiffs data spiffs 0xc90000 0x360000
7 coredump data coredump 0xFF0000 0x10000

View File

@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
spiffs, data, spiffs, 0x150000,0xA0000,
coredump, data, coredump,0x1F0000,0x10000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x140000
5 spiffs data spiffs 0x150000 0xA0000
6 coredump data coredump 0x1F0000 0x10000

View File

@@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000,0x140000,
spiffs, data, spiffs, 0x290000,0x160000,
coredump, data, coredump,0x3F0000,0x10000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x140000
5 app1 app ota_1 0x150000 0x140000
6 spiffs data spiffs 0x290000 0x160000
7 coredump data coredump 0x3F0000 0x10000

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

41
extra/tools/file2bin.c Normal file
View File

@@ -0,0 +1,41 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(int argc,char ** argv)
{
FILE *fp=NULL;
FILE *fw=NULL;
if(argc>1){
fp=fopen(argv[1],"rb");
fw=fopen("result.h","wb");
}
if(fp==NULL) return 1;
printf("\n//File name : ");
puts(argv[1]);
printf("\nconst uint8_t val [] PROGMEM = {\n ");
fprintf(fw,"#ifndef _RESULT_H_\n");
fprintf(fw,"#define _RESULT_H_\n");
fprintf(fw,"\nconst uint8_t val [] = {\n ");
int hadread=0;
while(1){
//if(feof(fp)) break;
int f_justread=fgetc(fp);
if(f_justread==EOF) break;
fprintf(fw,"0x%02x,",f_justread);
hadread++;
if((hadread & 1023) ==0){
printf(" // %d KB converted.\n",(hadread>>10));
fprintf(fw,"// %d KB converted.",(hadread>>10));
}
if((hadread & 31) ==0){
fprintf(fw,"\n ");
}
}
fprintf(fw,"\n};\n//Total File size is %d bytes.\n",hadread);
fprintf(fw,"\n#endif\n");
fclose(fp);
fclose(fw);
printf("\n};\nTotal File size is %d bytes.\n",hadread);
return 0;
}

BIN
extra/tools/file2bin.exe Normal file

Binary file not shown.