V3.0:add password and setting

This commit is contained in:
JasonYANG170 2024-05-17 03:24:36 +08:00
parent b87d2e6f43
commit 302fe2c202
2 changed files with 389 additions and 201 deletions

View File

@ -2,6 +2,6 @@
<project version="4">
<component name="Arduino Project Settings">
<option name="baudRate" value="115200" />
<option name="port" value="COM30" />
<option name="port" value="COM12" />
</component>
</project>

View File

@ -30,7 +30,7 @@
//配置数据结构
using namespace std;
int OutPutTimes;
int modelchooese=0;//0:JSON,1:TXT
int modelchooese=0;//0:JSON,1:TXT,2:SET
String OutPutString = "";
int keySize;
char* passwordIn;
@ -38,7 +38,7 @@ struct key {
String user;
String password;
};
int passwordst=0;
const char* data = "Callback function called";
//#include <Arduino.h>
#include <U8g2lib.h>
@ -57,92 +57,59 @@ const char* data = "Callback function called";
// #define BTN0 5
// #define BTN1 6
// #define BTN2 7
#define READ 2
#define BTN0 12
#define BTN1 18
#define BTN2 19
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* clock=*/ 5, /* data=*/ 4); // ESP32 Thing, pure SW emulated I2C
#define BTN0 12
#define BTN1 1
#define BTN2 0
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* clock=*/ 9, /* data=*/ 8); // ESP32 Thing, pure SW emulated I2C
PROGMEM const uint8_t icon_pic[][200]
{
{
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x3E,
0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00,
0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00,
0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00,
0x7F, 0x00, 0x00, 0x00, 0x80, 0x7F, 0x00, 0x00,
0x00, 0x80, 0x7F, 0x00, 0x00, 0x00, 0xC0, 0x7F,
0x00, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0x00,
0xF8, 0x7F, 0x00, 0x00, 0xF0, 0xF8, 0xFF, 0xFF,
0x01,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x00,
0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x80,
0xFF,0xFF,0x1F,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x80,0x1F,
0x80,0x1F,0x00,0x80,0x1F,0x80,0x1F,0x00,0x80,0x1F,0x80,0x1F,0x00,0x80,0x1F,0x80,
0x1F,0x00,0x80,0x1F,0xB0,0x1F,0x00,0x80,0x1F,0xB0,0x1F,0x00,0x80,0x1F,0x80,0x1F,
0x00,0x80,0x1F,0x80,0x1F,0x00,0x80,0x1F,0x80,0x1F,0x00,0x80,0x1F,0x80,0x1F,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,/*"C:\Users\qw200\Desktop\home.bmp",0*/
},
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00,
0x00, 0x1F, 0x00, 0x00, 0x00, 0x80, 0x1F, 0x00,
0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xC0,
0x3F, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00,
0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xE0, 0xFF,
0x00, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00,
0xFC, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0xFF, 0xFF,
0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0xFE, 0xFF,
0xFF, 0xFF, 0x07, 0xFC, 0xFF, 0xFF, 0xFF, 0x07,
0xFC, 0xFF, 0xFF, 0xFF, 0x03, 0xF8, 0xFF, 0xFF,
0xFF, 0x01, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0xE0,
0xFF, 0xFF, 0x7F, 0x00, 0xC0, 0xFF, 0xFF, 0x3F,
0x00, 0x80, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xFF,
0xFF, 0x1F, 0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00,
0x00, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xFF, 0xFF,
0x0F, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x00, 0x00,
0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xFF, 0xFF, 0x0F,
0x00, 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0xFF,
0xFF, 0x1F, 0x00, 0x80, 0xFF, 0xF0, 0x1F, 0x00,
0x80, 0x3F, 0xC0, 0x1F, 0x00, 0x80, 0x1F, 0x00,
0x1F, 0x00, 0x00, 0x07, 0x00, 0x1C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00/*"C:\Users\ROG\Desktop\三连\收藏.bmp",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,
0x00,0x0F,0x00,0x00,0x00,0x00,0xFF,0x3F,0x00,0x00,0x00,0xFF,0x3F,0x00,0x00,0x00,
0xFF,0x3F,0x00,0x00,0x00,0xFF,0x3F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x0F,
0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x0F,0x00,
0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0xE0,0x7F,0x00,0x00,0x00,0xF8,0xFF,0x01,0x00,
0x00,0xFC,0xFF,0x03,0x00,0x00,0xFE,0xFF,0x07,0x00,0x00,0xFF,0xFF,0x0F,0x00,0x00,
0xFF,0xFF,0x0F,0x00,0x80,0xFF,0xFF,0x1F,0x00,0x80,0x7F,0xE0,0x1F,0x00,0x80,0x3F,
0xC0,0x1F,0x00,0x80,0x3F,0xC0,0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, 0xF8, 0xFF, 0xF1,
0xFF, 0x01, 0xF0, 0xFF, 0xF1, 0xFF, 0x01, 0xF0,
0xFF, 0xF1, 0xFF, 0x00, 0xE0, 0xFF, 0xF1, 0x7F,
0x00, 0xC0, 0xFF, 0xFF, 0x7F, 0x00, 0x80, 0xFF,
0xFF, 0x3F, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x00,
0x00, 0xFC, 0xFF, 0x07, 0x00, 0x00, 0xF0, 0xFF,
0x01, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 /*"C:\Users\ROG\Desktop\三连\投币.bmp",0*/
/* (36 X 36 )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,
0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0x00,0xE0,0xFF,0xFF,
0xFF,0x00,0xE0,0xFF,0xFF,0xFF,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,
0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,
0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,
0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,
0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,
0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,
0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,0x00,0x80,0x3F,0x00,0x00,
0x00,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,/*"C:\Users\qw200\Desktop\home.bmp",0*/
},
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -171,7 +138,7 @@ PROGMEM const uint8_t icon_pic[][200]
},
};
uint8_t icon_width[] = { 35,37,36,36 };
uint8_t icon_width[] = { 36,36,36,36 };
//main界面图片
PROGMEM const uint8_t LOGO[] =
@ -179,49 +146,47 @@ PROGMEM const uint8_t LOGO[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x01,0x24,0x00,0x44,0x04,0x80,0x20,0x00,0x00,0x10,0xF2,0x3C,0x20,0xE0,0x00,
0x10,0x01,0x24,0x00,0xC4,0x04,0x80,0x20,0x00,0x00,0x10,0x11,0x24,0x30,0x10,0x01,
0x10,0x71,0x24,0x0F,0xC4,0xE2,0x99,0x3C,0x00,0x00,0x20,0x11,0x24,0x20,0x10,0x01,
0xF0,0x89,0xA4,0x10,0xA8,0x12,0x8A,0x22,0x00,0x00,0x20,0xF1,0x1C,0x20,0x10,0x01,
0x10,0xF9,0xA4,0x10,0x98,0x13,0x8A,0x22,0x00,0x00,0xA0,0x10,0x24,0x20,0x10,0x01,
0x10,0x09,0xA4,0x10,0x98,0x11,0x8A,0x22,0x00,0x00,0xA0,0x10,0x24,0x20,0x10,0x01,
0x10,0xF1,0x24,0x0F,0x10,0xE1,0x89,0x3C,0x00,0x00,0x40,0xF0,0x44,0x20,0xE2,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xEF,0x0F,0x70,0x00,0x00,0x00,0x00,0x00,0xE0,0xD8,0x87,0x3F,
0x00,0x00,0x00,0x80,0xEF,0x0F,0x00,0x07,0x00,0x00,0x00,0x00,0xE0,0xDC,0x8F,0x3F,
0x98,0xFF,0x7F,0xBF,0x0F,0x8F,0xFF,0xFF,0x03,0x00,0x00,0x00,0xE0,0x1D,0x8F,0x07,
0x98,0xE1,0xFF,0x3F,0x87,0x87,0x73,0x77,0x03,0x00,0x00,0x00,0xC0,0x9F,0x87,0x1F,
0x98,0xFD,0xF7,0x3B,0x87,0x83,0x7F,0xF7,0x07,0x00,0x00,0x00,0xC0,0xCF,0x03,0x3C,
0xB0,0xF7,0xF7,0x3F,0xC7,0x73,0x7E,0x7F,0x00,0x00,0x00,0x00,0xC0,0xE7,0xB7,0x3F,
0xF0,0xFE,0xF7,0x3F,0xE7,0xF1,0x7F,0xFF,0x03,0x00,0x00,0x00,0x80,0xE7,0xB7,0x1F,
0xF0,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x70,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7C,0x00,0x80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7F,
0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,
0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -230,16 +195,18 @@ PROGMEM const uint8_t LOGO[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x40,0x00,0x02,0x10,0x00,0x00,
0x00,0x00,0x88,0x00,0x00,0x00,0x00,0x08,0x08,0x00,0x60,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x88,0x9C,0x24,0xC7,0x1C,0x0F,0x68,0x22,0xA0,0xCC,0x23,0x91,0xC7,0x01,
0x00,0xFE,0x88,0xA2,0xAA,0x48,0xA2,0x08,0x98,0x14,0xB0,0x24,0x22,0x91,0x24,0x02,
0x00,0x00,0x78,0xA2,0xAB,0x4F,0xBE,0x08,0x88,0x14,0xF0,0x24,0x22,0x91,0x24,0x02,
0x00,0x00,0x08,0x22,0x9B,0x40,0x82,0x08,0x88,0x0C,0x08,0x25,0x22,0x91,0x24,0x02,
0x00,0x00,0x08,0x1C,0x11,0x4F,0x3C,0x0F,0x78,0x08,0x08,0xC5,0xE3,0x91,0xC4,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x38,0x9E,0xDF,0xDF,0xF3,0x30,0xCF,0x73,0x7F,0xDE,0x1F,
0x00,0x00,0x00,0x00,0x00,0x38,0x9F,0xFF,0xFF,0xF7,0x99,0xDF,0xF7,0x7F,0xDF,0x1F,
0x00,0x00,0x00,0x00,0x00,0xB8,0xBB,0xE7,0xFD,0xF7,0x9F,0xD9,0xF7,0x07,0x1F,0x0E,
0x00,0x00,0x00,0x00,0x00,0xB8,0x31,0xFF,0xF8,0x7F,0xCF,0xD9,0xFD,0x7B,0x0E,0x0F,
0x00,0x00,0x00,0x00,0x00,0xFC,0x3F,0xFE,0xFC,0x7C,0xC7,0xFF,0xFD,0x7B,0x8E,0x07,
0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x7C,0xE7,0xFF,0xFD,0x7F,0x8E,0x07,
0x00,0x00,0x00,0x00,0x00,0xFF,0xF1,0xCF,0xDF,0x3C,0xF7,0xF9,0x3D,0x7F,0xCE,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"C:\Users\qw200\Desktop\indexa.bmp",0*/
};
const float PID_MAX = 10.00;//PID最大允许值
@ -304,6 +271,8 @@ enum//ui_index
M_ABOUT,//关于本机
M_IMPORT,
M_TXTREAD,
M_ABOUTDEV,
M_SET
};
@ -325,9 +294,9 @@ typedef struct
char* select;
} SELECT_LIST;
SELECT_LIST* list = NULL; // 初始化结构体数组指针
SELECT_LIST* list = NULL; // (主要的菜单结构,用于展示站点和文本)初始化结构体数组指针
SELECT_LIST* pid = NULL; // 初始化结构体数组指针
SELECT_LIST* pid = NULL; // (二级菜单结构,用于展示站点的多个用户)初始化结构体数组指针
uint8_t pid_num = 5;//PID选项数量
@ -352,16 +321,21 @@ uint8_t total_line_length = single_line_length * listSize + 1;
SELECT_LIST icon[]
{
{"Main"},
{"HOME"},
{"Authenticator"},
{"Import"},
{"Edit"},
{"TXT"},
{"SET"},
{"LOCK"},
};
//设备名称
char name[] = "Hello World ";
char name[] = "";
String Passwordis="";
//允许名字的最大长度
const uint8_t name_len = 12;//0-11for name 12 for return
const uint8_t name_len = 6;//0-11for name 12 for return
char title[] = "Password";
char bt[] = "sure";
uint8_t edit_index = 0;
bool edit_flag = false;//默认不在编辑
uint8_t blink_flag;//默认高亮
@ -689,6 +663,8 @@ void text_edit(bool dir, uint8_t index)
name[index] = 'a';
}
}
Serial.println("NOW IS");
Serial.println(name);
}
//消失函数
@ -778,8 +754,20 @@ void txtread(){
void logo_ui_show()//显示logo
{
u8g2.drawXBMP(0, 0, 128, 64, LOGO);
if (!SD.begin(7)) {
Serial.println("SD 卡初始化失败!");
u8g2.firstPage();
do {
u8g2.drawStr(0, 10, "No Find TF card !");
u8g2.drawStr(0, 23, "Please check it");
u8g2.drawStr(0, 36, "And restart...");
u8g2.drawStr(0, 49, "More see at yang17.site");
u8g2.drawStr(0, 62," ---KeyBox");
} while (u8g2.nextPage());
}else {
u8g2.drawXBMP(0, 0, 128, 64, LOGO);
}
// for(uint16_t i=0;i<buf_len;++i)
// {
// if(i%4==0||i%4==1)
@ -913,7 +901,7 @@ void chart_ui_show()//chart界面
{
u8g2.clearBuffer();
chart_draw_frame();
angle_last = 20.00 + (float)analogRead(READ) / 100.00;
// angle_last = 20.00 + (float)analogRead(READ) / 100.00;
frame_is_drawed = true;
}
@ -931,7 +919,7 @@ void chart_ui_show()//chart界面
//异或绘制
u8g2.setDrawColor(2);
angle = 20.00 + (float)analogRead(READ) / 100.00;
// angle = 20.00 + (float)analogRead(READ) / 100.00;
u8g2.drawLine(chart_x + 11, 58 - (int)angle_last / 2, chart_x + 12, 58 - (int)angle / 2);
u8g2.drawVLine(chart_x + 12, 59, 3);
angle_last = angle;
@ -950,9 +938,9 @@ void chart_ui_show()//chart界面
void text_edit_ui_show()
{
u8g2.drawRFrame(4, 6, 120, 52, 8);
u8g2.drawStr((128 - u8g2.getStrWidth("--Text Editor--")) / 2, 20, "--Text Editor--");
u8g2.drawStr((128 - u8g2.getStrWidth(title)) / 2, 20, title);
u8g2.drawStr(10, 38, name);
u8g2.drawStr(80, 50, "-Return");
u8g2.drawStr(80, 50, bt);
uint8_t box_x = 9;
@ -979,7 +967,7 @@ void text_edit_ui_show()
else
{
u8g2.setDrawColor(2);
u8g2.drawRBox(78, 38, u8g2.getStrWidth("-Return") + 4, 16, 1);
u8g2.drawRBox(78, 38, u8g2.getStrWidth(bt) + 4, 16, 1);
u8g2.setDrawColor(1);
}
@ -1002,7 +990,19 @@ void text_edit_ui_show()
}
char* SiteIn;
char* UserIn;
void aboutdev_ui_show()//about界面
{
// std::string SiteStr = SiteIn;
// u8g2.drawStr(2, 10, "---Press to Driver---");
// u8g2.drawStr(2, 10, "---Press to Driver---");
// u8g2.drawStr(2, 10, "---Press to Driver---");
//u8g2.setContrast(10);
u8g2.drawStr(2,12,"MCU : ESP32C3");
u8g2.drawStr(2,28,"FLASH : 4MB");
u8g2.drawStr(2,44,"Site : yang17.site");
u8g2.drawStr(2,60,"Firmware : V3.0");
}
void about_ui_show()//about界面
{
// std::string SiteStr = SiteIn;
@ -1049,9 +1049,20 @@ void logo_proc()//logo界面处理函数
{
if (key_msg.pressed)
{
key_msg.pressed = false;
if(passwordst==0) {
ui_state = S_DISAPPEAR;
ui_index = M_ICON;
}else{
key_msg.pressed = false;
ui_state = S_DISAPPEAR;
ui_index = M_TEXT_EDIT;
}
}
logo_ui_show();
}
@ -1187,6 +1198,7 @@ void select_proc(void)//选择界面处理重要的
break;
case 2:
Serial.println("ui_select");
switch (ui_select)
{
case 0: //return
@ -1223,6 +1235,7 @@ void select_proc(void)//选择界面处理重要的
// ui_index = M_ABOUT;
// break;
default: {
Serial.println("modelchooese");
Serial.println(modelchooese);
if (modelchooese == 0) {
SiteIn = list[ui_select].select;
@ -1234,11 +1247,11 @@ void select_proc(void)//选择界面处理重要的
ui_state = S_DISAPPEAR;
ui_index = M_PID;
break;
} else {
} else if (modelchooese == 1){
// list[ui_select].select
//txt
ui_state = S_DISAPPEAR;
File file = SD.open("/hh.txt");
File file = SD.open("/"+(String)list[ui_select].select+".txt");
if (file) {
Serial.println("txt on");
while (file.available()) {
@ -1260,9 +1273,16 @@ void select_proc(void)//选择界面处理重要的
ui_index = M_TXTREAD;
break;
} else if (modelchooese == 2) {
Serial.print("NOW:");
Serial.println(list[ui_select].select);
ui_state = S_DISAPPEAR;
ui_index = M_SET;
}
}
}
//Serial.println("Btn2");
default:
break;
@ -1274,6 +1294,69 @@ void select_proc(void)//选择界面处理重要的
}
select_ui_show();
}
void setting(int select){
switch (select) {
case 1:
ui_state = S_DISAPPEAR;
ui_index = M_TEXT_EDIT;
break;
case 2:
free(pid);
pid = NULL;
pidSize=5;//此值自增1才可出返回设置
pid = (SELECT_LIST*)malloc(pidSize * sizeof(SELECT_LIST));
pid[0].select =strdup("1min");
pid[1].select =strdup("5min");
pid[2].select =strdup("10min");
pid[3].select =strdup("Never");
pid[4].select =strdup("back");
pid_box_width = pid_box_width_trg = u8g2.getStrWidth(pid[pid_select].select) + x * 2;//两边各多2
ui_state = S_DISAPPEAR;
ui_index = M_PID;
break;
case 3:
// ui_state = S_DISAPPEAR;
u8g2.drawStr(2,12,"Not Find New DATA");
// u8g2.drawStr(2,28,"FLASH : 4MB");
u8g2.drawStr(2,44,"Press any key go back");
// u8g2.drawStr(2,60,"Firmware : V3.0");
break;
case 4:
ui_state = S_DISAPPEAR;
ui_index = M_ABOUTDEV;
break;
default:
Serial.println("now is default");
break;
}
}
void set_proc(){
setting(ui_select);
Serial.println("txgog11111111111111ogote");
if (key_msg.pressed)
{
key_msg.pressed = false;
switch (key_msg.id)
{
case 2: {
// writeCSV();存在危险操作,建议提高延迟,否则易损卡
}
default:
ui_state = S_DISAPPEAR;
ui_index = M_SELECT;
break;
}
}
}
void allcount();
void addSiteDataToArr();
void icon_proc(void)//icon界面处理
@ -1312,7 +1395,7 @@ void icon_proc(void)//icon界面处理
modelchooese=0;
allcount();
addSiteDataToArr();
list[0].select = strdup("Main");
list[0].select = strdup("HOME");
box_width = box_width_trg = u8g2.getStrWidth(list[ui_select].select) + x * 2;//两边各多2
@ -1337,7 +1420,7 @@ void icon_proc(void)//icon界面处理
modelchooese=1;
allcount();
addSiteDataToArr();
list[0].select = strdup("Main");
list[0].select = strdup("HOME");
box_width = box_width_trg = u8g2.getStrWidth(list[ui_select].select) + x * 2;//两边各多2
@ -1354,6 +1437,45 @@ void icon_proc(void)//icon界面处理
ui_state = S_DISAPPEAR;
ui_index = M_SELECT;
break;
case 3:
// ui_state = S_DISAPPEAR;
// ui_index = M_IMPORT;
Serial.println("ui_select11");
modelchooese=2;
listSize=5;
Serial.println("ui_select22");
free(list);
list = NULL;
list = (SELECT_LIST*)malloc(listSize * sizeof(SELECT_LIST));
list[0].select = strdup("HOME");
list[1].select = strdup("Password");
list[2].select = strdup("Back light");
list[3].select = strdup("Updata");
list[4].select = strdup("About");
Serial.println("ui_selectsadad");
box_width = box_width_trg = u8g2.getStrWidth(list[ui_select].select) + x * 2;//两边各多2
Serial.println("ui_select33");
// pid = (SELECT_LIST*)malloc(pidSize * sizeof(SELECT_LIST));
// pid[0].select = strdup("main");
// 动态分配内存以存储结构体数组
// qsort(list + 1, listSize - 1, sizeof(SELECT_LIST), compare);
Serial.println("ui_select33");
// 在串口上打印按照字母顺序排序后的结果
for (int i = 0; i < listSize; i++) {
Serial.println(list[i].select);
}
ui_state = S_DISAPPEAR;
ui_index = M_SELECT;
Serial.println("ui_select3366");
break;
case 4:
if(Passwordis!=""){
passwordst=1;
}
ui_state = S_DISAPPEAR;
ui_index = M_LOGO;
break;
}
Serial.println("button press");
@ -1385,7 +1507,38 @@ void chart_proc()//chart界面处理函数
chart_x = 0;
}
}
void passwordmode(){
for (int i = 0; i < 6; i++) {
if (name[i] != '\0') {
if (passwordst == 0) {
Passwordis = name;
passwordst=1;
ui_state = S_DISAPPEAR;
ui_index = M_LOGO;
}else if (passwordst == 1&&Passwordis == name) {
passwordst=0;
ui_state = S_DISAPPEAR;
ui_index = M_ICON;
}else{
ui_state = S_DISAPPEAR;
ui_index = M_LOGO;
}
break;
}else{
if (passwordst == 0) {
ui_state = S_DISAPPEAR;
ui_index = M_LOGO;
}
}
}
}
void text_edit_proc()
{
text_edit_ui_show();
@ -1431,11 +1584,13 @@ void text_edit_proc()
}
break;
case 2:
if (edit_index == name_len)
{
ui_state = S_DISAPPEAR;
ui_index = M_SELECT;
if (edit_index == name_len) {
edit_index = 0;
passwordmode();
memset(name, '\0', sizeof(name));
}
else
{
@ -1443,6 +1598,7 @@ void text_edit_proc()
}
break;
default:
break;
}
}
@ -1458,7 +1614,16 @@ void about_proc()//about界面处理函数
}
about_ui_show();
}
void aboutdev_proc()//about界面处理函数
{
if (key_msg.pressed)
{
key_msg.pressed = false;
ui_state = S_DISAPPEAR;
ui_index = M_SELECT;
}
aboutdev_ui_show();
}
void import_proc()//about界面处理函数
{
u8g2.setFont(u8g2_font_ncenB08_tr);
@ -1526,6 +1691,7 @@ void txtred_proc(){
}
}
/********************************总的UI显示************************************/
void ui_proc()//总的UI进程
@ -1561,11 +1727,19 @@ void ui_proc()//总的UI进程
about_proc();
break;
case M_ABOUTDEV:
aboutdev_proc();
break;
case M_IMPORT:
import_proc();
break;
case M_TXTREAD:
txtred_proc();
break;
case M_SET:
set_proc();
break;
default:
break;
}
@ -1588,7 +1762,7 @@ void addUser(char* mainnowdisplay){
pid = NULL;
Serial.println("Btn2----------------------");
Serial.println(mainnowdisplay);
String filePath = String("/") + String(mainnowdisplay);
String filePath = String("/") + String(mainnowdisplay)+String(".json") ;
// 打开 data.json 文件
File jsonFile = SD.open(filePath);
if (!jsonFile) {
@ -1621,11 +1795,13 @@ void addUser(char* mainnowdisplay){
}
Serial.print("numx------------xxx: ");
Serial.println(numx);
pidSize=numx+1;//此值自增1才可出返回设置
pid = (SELECT_LIST*)malloc(pidSize * sizeof(SELECT_LIST));
int num=0;
// 仅输出JSON键而不输出值
for (JsonPair keyValue : doc.as<JsonObject>()) {
@ -1652,7 +1828,7 @@ void addUser(char* mainnowdisplay){
void addPassword(char* mainsite,char* mainuser){
String filePath = String("/") + String(mainsite);
String filePath = String("/") + String(mainsite)+String(".json");
// 打开 data.json 文件
File jsonFile = SD.open(filePath);
@ -1738,6 +1914,7 @@ void addSiteDataToArr() {//此函数提供方法使其全部网站保存在数
Serial.println("read JSON Start:");
File root = SD.open("/");
int index = 0; // 用于追踪数组中的索引位置
list = (SELECT_LIST*)malloc(listSize * sizeof(SELECT_LIST));
int fileCount = 0;//此值传向list 数组长度
while (true) {
@ -1752,7 +1929,20 @@ void addSiteDataToArr() {//此函数提供方法使其全部网站保存在数
const char* filename = entry.name();
if (strstr(filename, model) != NULL) {
Serial.println(filename);
list[index+1].select = strdup(filename);
// const char* filename = "example.txt"; // 您的文件名
int length = strlen(filename);
char* newFilename = new char[length]; // 创建动态分配的新字符串来存储较短的文件名
if(modelchooese==0) {
strncpy(newFilename, filename, length - 5);
newFilename[length - 5] = '\0'; // 添加字符串终止符
}else{
strncpy(newFilename, filename, length - 4);
newFilename[length - 4] = '\0'; // 添加字符串终止符
}
list[index+1].select = strdup(newFilename);
index++;
}
}
@ -1765,10 +1955,7 @@ void setup() {//加大审查尽量关闭sd卡使用时间延长寿命
Serial.begin(115200);
if (!SD.begin(7)) {
Serial.println("SD 卡初始化失败!");
return;
}
// 写入数据到 data.json 文件
// writeJSONToFile();
@ -1777,7 +1964,7 @@ void setup() {//加大审查尽量关闭sd卡使用时间延长寿命
// readAndPrintAllJSONFiles();
// readJSONFile() ;
Serial.println("entry");
//Wire.begin(21,22,400000);
pinMode(BTN0, INPUT_PULLUP);
@ -1787,7 +1974,7 @@ void setup() {//加大审查尽量关闭sd卡使用时间延长寿命
u8g2.setBusClock(800000);
u8g2.begin();
u8g2.setFont(u8g2_font_wqy12_t_chinese1);
u8g2.setFont(u8g2_font_unifont_t_chinese1);
//u8g2.setContrast(10);
buf_ptr = u8g2.getBufferPtr();//拿到buffer首地址
@ -1805,10 +1992,11 @@ void setup() {//加大审查尽量关闭sd卡使用时间延长寿命
ui_index = M_LOGO;
// ui_index=M_TEXT_EDIT;
ui_state = S_NONE;
Serial.println("entry2");
}
void loop() {
Serial.println("entry3");
key_scan();
ui_proc();
}