Batch appercase hex values
This commit is contained in:
committed by
Scott Lahteine
parent
3facf34f5f
commit
7e09160ba3
@ -1060,11 +1060,11 @@ void CLCD::init() {
|
||||
|
||||
delay(40); // FTDI/BRT recommendation: no SPI traffic during startup. EVE needs at the very least 45ms to start, so leave her alone for a little while.
|
||||
|
||||
/* read the device-id until it returns 0x7c or times out, should take less than 150ms */
|
||||
/* read the device-id until it returns 0x7C or times out, should take less than 150ms */
|
||||
uint8_t counter;
|
||||
for (counter = 0; counter < 250; counter++) {
|
||||
uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C;
|
||||
if (device_id == 0x7c) {
|
||||
if (device_id == 0x7C) {
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
SERIAL_ECHO_MSG("FTDI chip initialized ");
|
||||
#endif
|
||||
|
@ -63,7 +63,7 @@ namespace FTDI {
|
||||
static constexpr uint32_t RAM_REG = 0x102400; // Registers
|
||||
static constexpr uint32_t RAM_CMD = 0x108000; // Command Buffer
|
||||
|
||||
static constexpr uint32_t RAM_G_SIZE = 256*1024l; // 256k
|
||||
static constexpr uint32_t RAM_G_SIZE = 256*1024L; // 256k
|
||||
};
|
||||
|
||||
struct ft800_registers {
|
||||
|
@ -61,7 +61,7 @@ namespace FTDI {
|
||||
static constexpr uint32_t RAM_REG = 0x302000; // Registers
|
||||
static constexpr uint32_t RAM_CMD = 0x308000; // Command Buffer
|
||||
|
||||
static constexpr uint32_t RAM_G_SIZE = 1024*1024l; // 1024k
|
||||
static constexpr uint32_t RAM_G_SIZE = 1024*1024L; // 1024k
|
||||
};
|
||||
|
||||
struct ft810_registers {
|
||||
|
@ -60,12 +60,12 @@
|
||||
constexpr uint16_t Hoffset = 70;
|
||||
constexpr uint16_t Hcycle = 408;
|
||||
|
||||
constexpr uint32_t default_transform_a = 0x000054ad;
|
||||
constexpr uint32_t default_transform_b = 0xffffff52;
|
||||
constexpr uint32_t default_transform_c = 0xfff7f6e4;
|
||||
constexpr uint32_t default_transform_a = 0x000054AD;
|
||||
constexpr uint32_t default_transform_b = 0xFFFFFF52;
|
||||
constexpr uint32_t default_transform_c = 0xFFF7F6E4;
|
||||
constexpr uint32_t default_transform_d = 0x00000065;
|
||||
constexpr uint32_t default_transform_e = 0xffffbe3b;
|
||||
constexpr uint32_t default_transform_f = 0x00f68e75;
|
||||
constexpr uint32_t default_transform_e = 0xFFFFBE3B;
|
||||
constexpr uint32_t default_transform_f = 0x00F68E75;
|
||||
}
|
||||
|
||||
#elif defined(TOUCH_UI_480x272)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -236,14 +236,14 @@ void lv_draw_keyboard() {
|
||||
lv_style_copy(&rel_style, &lv_style_btn_rel);
|
||||
rel_style.body.radius = 0;
|
||||
rel_style.body.border.width = 1;
|
||||
rel_style.body.main_color = lv_color_make(0xa9, 0x62, 0x1d);
|
||||
rel_style.body.grad_color = lv_color_make(0xa7, 0x59, 0x0e);
|
||||
rel_style.body.main_color = lv_color_make(0xA9, 0x62, 0x1D);
|
||||
rel_style.body.grad_color = lv_color_make(0xA7, 0x59, 0x0E);
|
||||
|
||||
lv_style_copy(&pr_style, &lv_style_btn_pr);
|
||||
pr_style.body.radius = 0;
|
||||
pr_style.body.border.width = 1;
|
||||
pr_style.body.main_color = lv_color_make(0x72, 0x42, 0x15);
|
||||
pr_style.body.grad_color = lv_color_make(0x6a, 0x3a, 0x0c);
|
||||
pr_style.body.grad_color = lv_color_make(0x6A, 0x3A, 0x0C);
|
||||
|
||||
/*Create a keyboard and apply the styles*/
|
||||
lv_obj_t *kb = lv_kb_create(scr, NULL);
|
||||
|
@ -479,9 +479,9 @@ int ascii2dec_test(char *ascii) {
|
||||
if (*(ascii) >= '0' && *(ascii) <= '9')
|
||||
result = *(ascii) - '0';
|
||||
else if (*(ascii) >= 'a' && *(ascii) <= 'f')
|
||||
result = *(ascii) - 'a' + 0x0a;
|
||||
result = *(ascii) - 'a' + 0x0A;
|
||||
else if (*(ascii) >= 'A' && *(ascii) <= 'F')
|
||||
result = *(ascii) - 'A' + 0x0a;
|
||||
result = *(ascii) - 'A' + 0x0A;
|
||||
else
|
||||
return 0;
|
||||
|
||||
@ -525,7 +525,7 @@ void lv_gcode_file_read(uint8_t *data_buf) {
|
||||
p_index = (uint16_t *)(&public_buf[i]);
|
||||
|
||||
//Color = (*p_index >> 8);
|
||||
//*p_index = Color | ((*p_index & 0xff) << 8);
|
||||
//*p_index = Color | ((*p_index & 0xFF) << 8);
|
||||
i += 2;
|
||||
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
|
||||
}
|
||||
@ -533,7 +533,7 @@ void lv_gcode_file_read(uint8_t *data_buf) {
|
||||
for (i = 0; i < 200;) {
|
||||
p_index = (uint16_t *)(&public_buf[i]);
|
||||
//Color = (*p_index >> 8);
|
||||
//*p_index = Color | ((*p_index & 0xff) << 8);
|
||||
//*p_index = Color | ((*p_index & 0xFF) << 8);
|
||||
i += 2;
|
||||
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // 0x18C3;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ void tft_style_init() {
|
||||
style_sel_text.text.letter_space = 0;
|
||||
style_sel_text.text.line_space = -5;
|
||||
lv_style_copy(&style_line, &lv_style_plain);
|
||||
style_line.line.color = LV_COLOR_MAKE(0x49, 0x54, 0xff);
|
||||
style_line.line.color = LV_COLOR_MAKE(0x49, 0x54, 0xFF);
|
||||
style_line.line.width = 1;
|
||||
style_line.line.rounded = 1;
|
||||
|
||||
@ -703,12 +703,12 @@ char *creat_title_text() {
|
||||
card.closefile();
|
||||
|
||||
/*
|
||||
if (gCurFileState.file_open_flag != 0xaa) {
|
||||
if (gCurFileState.file_open_flag != 0xAA) {
|
||||
reset_file_info();
|
||||
res = f_open(file, curFileName, FA_OPEN_EXISTING | FA_READ);
|
||||
if (res == FR_OK) {
|
||||
f_lseek(file,PREVIEW_SIZE+To_pre_view);
|
||||
gCurFileState.file_open_flag = 0xaa;
|
||||
gCurFileState.file_open_flag = 0xAA;
|
||||
//bakup_file_path((uint8_t *)curFileName, strlen(curFileName));
|
||||
srcfp = file;
|
||||
mksReprint.mks_printer_state = MKS_WORKING;
|
||||
@ -803,7 +803,7 @@ char *creat_title_text() {
|
||||
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
||||
|
||||
Color = (*p_index >> 8);
|
||||
*p_index = Color | ((*p_index & 0xff) << 8);
|
||||
*p_index = Color | ((*p_index & 0xFF) << 8);
|
||||
i += 2;
|
||||
if (*p_index == 0x0000) *p_index = 0xC318;
|
||||
}
|
||||
@ -835,12 +835,12 @@ char *creat_title_text() {
|
||||
card.closefile();
|
||||
|
||||
/*
|
||||
if (gCurFileState.file_open_flag != 0xaa) {
|
||||
if (gCurFileState.file_open_flag != 0xAA) {
|
||||
reset_file_info();
|
||||
res = f_open(file, curFileName, FA_OPEN_EXISTING | FA_READ);
|
||||
if (res == FR_OK) {
|
||||
f_lseek(file,PREVIEW_SIZE+To_pre_view);
|
||||
gCurFileState.file_open_flag = 0xaa;
|
||||
gCurFileState.file_open_flag = 0xAA;
|
||||
//bakup_file_path((uint8_t *)curFileName, strlen(curFileName));
|
||||
srcfp = file;
|
||||
mksReprint.mks_printer_state = MKS_WORKING;
|
||||
@ -1650,7 +1650,7 @@ void print_time_count() {
|
||||
void LV_TASK_HANDLER() {
|
||||
//lv_tick_inc(1);
|
||||
lv_task_handler();
|
||||
if (mks_test_flag == 0x1e) mks_hardware_test();
|
||||
if (mks_test_flag == 0x1E) mks_hardware_test();
|
||||
|
||||
#if HAS_GCODE_PREVIEW
|
||||
disp_pre_gcode(2, 36);
|
||||
|
@ -92,7 +92,7 @@
|
||||
|
||||
#define TICK_CYCLE 1
|
||||
|
||||
#define PARA_SEL_ICON_TEXT_COLOR LV_COLOR_MAKE(0x4a, 0x52, 0xff);
|
||||
#define PARA_SEL_ICON_TEXT_COLOR LV_COLOR_MAKE(0x4A, 0x52, 0xFF);
|
||||
|
||||
#define TFT35
|
||||
|
||||
|
@ -662,7 +662,7 @@ const char *MKSTestPath = "MKS_TEST";
|
||||
void mks_test_get() {
|
||||
SdFile dir, root = card.getroot();
|
||||
if (dir.open(&root, MKSTestPath, O_RDONLY))
|
||||
mks_test_flag = 0x1e;
|
||||
mks_test_flag = 0x1E;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -543,7 +543,7 @@ void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
|
||||
PIC_MSG PIC;
|
||||
|
||||
W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
|
||||
if (Pic_cnt == 0xff)
|
||||
if (Pic_cnt == 0xFF)
|
||||
Pic_cnt = 0;
|
||||
|
||||
for (i = 0; i < Pic_cnt; i++) {
|
||||
|
@ -76,7 +76,7 @@
|
||||
#define PIC_DATA_ADDR 0x003000 //
|
||||
|
||||
// TFT35
|
||||
#define DEFAULT_VIEW_ADDR_TFT35 0x1ea070
|
||||
#define DEFAULT_VIEW_ADDR_TFT35 0x1EA070
|
||||
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
|
||||
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
|
||||
#define PIC_DATA_ADDR_TFT35 0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
|
||||
|
@ -198,10 +198,10 @@ void SysTick_Callback() {
|
||||
LCD_WriteReg(0x0046, xEnd);
|
||||
}
|
||||
else if (DeviceCode == 0x9488) {
|
||||
s_h = (StartX >> 8) & 0x00ff;
|
||||
s_l = StartX & 0x00ff;
|
||||
e_h = ((StartX + width - 1) >> 8) & 0x00ff;
|
||||
e_l = (StartX + width - 1) & 0x00ff;
|
||||
s_h = (StartX >> 8) & 0x00FF;
|
||||
s_l = StartX & 0x00FF;
|
||||
e_h = ((StartX + width - 1) >> 8) & 0x00FF;
|
||||
e_l = (StartX + width - 1) & 0x00FF;
|
||||
|
||||
LCD_IO_WriteReg(0x002A);
|
||||
LCD_IO_WriteData(s_h);
|
||||
@ -209,10 +209,10 @@ void SysTick_Callback() {
|
||||
LCD_IO_WriteData(e_h);
|
||||
LCD_IO_WriteData(e_l);
|
||||
|
||||
s_h = (StartY >> 8) & 0x00ff;
|
||||
s_l = StartY & 0x00ff;
|
||||
e_h = ((StartY + heigh - 1) >> 8) & 0x00ff;
|
||||
e_l = (StartY + heigh - 1) & 0x00ff;
|
||||
s_h = (StartY >> 8) & 0x00FF;
|
||||
s_l = StartY & 0x00FF;
|
||||
e_h = ((StartY + heigh - 1) >> 8) & 0x00FF;
|
||||
e_l = (StartY + heigh - 1) & 0x00FF;
|
||||
|
||||
LCD_IO_WriteReg(0x002B);
|
||||
LCD_IO_WriteData(s_h);
|
||||
@ -275,18 +275,18 @@ void SysTick_Callback() {
|
||||
//while(index --) LCD_IO_WriteData(Color);
|
||||
}
|
||||
else if (DeviceCode == 0x5761) {
|
||||
LCD_IO_WriteReg(0x002a);
|
||||
LCD_IO_WriteReg(0x002A);
|
||||
LCD_IO_WriteData(0);
|
||||
LCD_IO_WriteData(0);
|
||||
LCD_IO_WriteData(HDP >> 8);
|
||||
LCD_IO_WriteData(HDP & 0x00ff);
|
||||
LCD_IO_WriteReg(0x002b);
|
||||
LCD_IO_WriteData(HDP & 0x00FF);
|
||||
LCD_IO_WriteReg(0x002B);
|
||||
LCD_IO_WriteData(0);
|
||||
LCD_IO_WriteData(0);
|
||||
LCD_IO_WriteData(VDP >> 8);
|
||||
LCD_IO_WriteData(VDP & 0x00ff);
|
||||
LCD_IO_WriteReg(0x002c);
|
||||
LCD_IO_WriteReg(0x002c);
|
||||
LCD_IO_WriteData(VDP & 0x00FF);
|
||||
LCD_IO_WriteReg(0x002C);
|
||||
LCD_IO_WriteReg(0x002C);
|
||||
for (count = 0; count < (HDP + 1) * (VDP + 1); count++)
|
||||
LCD_IO_WriteData(Color);
|
||||
}
|
||||
@ -323,19 +323,19 @@ void SysTick_Callback() {
|
||||
LCD_IO_WriteReg(0x00E0);
|
||||
LCD_IO_WriteData(0x0000);
|
||||
LCD_IO_WriteData(0x0007);
|
||||
LCD_IO_WriteData(0x000f);
|
||||
LCD_IO_WriteData(0x000F);
|
||||
LCD_IO_WriteData(0x000D);
|
||||
LCD_IO_WriteData(0x001B);
|
||||
LCD_IO_WriteData(0x000A);
|
||||
LCD_IO_WriteData(0x003c);
|
||||
LCD_IO_WriteData(0x003C);
|
||||
LCD_IO_WriteData(0x0078);
|
||||
LCD_IO_WriteData(0x004A);
|
||||
LCD_IO_WriteData(0x0007);
|
||||
LCD_IO_WriteData(0x000E);
|
||||
LCD_IO_WriteData(0x0009);
|
||||
LCD_IO_WriteData(0x001B);
|
||||
LCD_IO_WriteData(0x001e);
|
||||
LCD_IO_WriteData(0x000f);
|
||||
LCD_IO_WriteData(0x001E);
|
||||
LCD_IO_WriteData(0x000F);
|
||||
|
||||
LCD_IO_WriteReg(0x00E1);
|
||||
LCD_IO_WriteData(0x0000);
|
||||
@ -348,11 +348,11 @@ void SysTick_Callback() {
|
||||
LCD_IO_WriteData(0x0047);
|
||||
LCD_IO_WriteData(0x0047);
|
||||
LCD_IO_WriteData(0x0006);
|
||||
LCD_IO_WriteData(0x000a);
|
||||
LCD_IO_WriteData(0x000A);
|
||||
LCD_IO_WriteData(0x0007);
|
||||
LCD_IO_WriteData(0x0030);
|
||||
LCD_IO_WriteData(0x0037);
|
||||
LCD_IO_WriteData(0x000f);
|
||||
LCD_IO_WriteData(0x000F);
|
||||
|
||||
LCD_IO_WriteReg(0x00C0);
|
||||
LCD_IO_WriteData(0x0010);
|
||||
|
@ -125,7 +125,7 @@ uint32_t getWifiTickDiff(int32_t lastTick, int32_t curTick) {
|
||||
return (curTick - lastTick) * TICK_CYCLE;
|
||||
}
|
||||
else {
|
||||
return (0xffffffff - lastTick + curTick) * TICK_CYCLE;
|
||||
return (0xFFFFFFFF - lastTick + curTick) * TICK_CYCLE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,8 +334,8 @@ void wifi_ret_ack() {}
|
||||
char buf_to_wifi[256];
|
||||
int index_to_wifi = 0;
|
||||
int package_to_wifi(WIFI_RET_TYPE type,char *buf, int len) {
|
||||
char wifi_ret_head = 0xa5;
|
||||
char wifi_ret_tail = 0xfc;
|
||||
char wifi_ret_head = 0xA5;
|
||||
char wifi_ret_tail = 0xFC;
|
||||
|
||||
if (type == WIFI_PARA_SET) {
|
||||
int data_offset = 4;
|
||||
@ -356,8 +356,8 @@ int package_to_wifi(WIFI_RET_TYPE type,char *buf, int len) {
|
||||
|
||||
buf_to_wifi[0] = wifi_ret_head;
|
||||
buf_to_wifi[1] = type;
|
||||
buf_to_wifi[2] = index_to_wifi & 0xff;
|
||||
buf_to_wifi[3] = (index_to_wifi >> 8) & 0xff;
|
||||
buf_to_wifi[2] = index_to_wifi & 0xFF;
|
||||
buf_to_wifi[3] = (index_to_wifi >> 8) & 0xFF;
|
||||
|
||||
raw_send_to_wifi(buf_to_wifi, 5 + index_to_wifi);
|
||||
|
||||
@ -392,8 +392,8 @@ int package_to_wifi(WIFI_RET_TYPE type,char *buf, int len) {
|
||||
|
||||
buf_to_wifi[0] = wifi_ret_head;
|
||||
buf_to_wifi[1] = type;
|
||||
buf_to_wifi[2] = index_to_wifi & 0xff;
|
||||
buf_to_wifi[3] = (index_to_wifi >> 8) & 0xff;
|
||||
buf_to_wifi[2] = index_to_wifi & 0xFF;
|
||||
buf_to_wifi[3] = (index_to_wifi >> 8) & 0xFF;
|
||||
buf_to_wifi[4 + index_to_wifi] = wifi_ret_tail;
|
||||
|
||||
raw_send_to_wifi(buf_to_wifi, 5 + index_to_wifi);
|
||||
@ -426,22 +426,22 @@ int package_to_wifi(WIFI_RET_TYPE type,char *buf, int len) {
|
||||
index_to_wifi = 0;
|
||||
|
||||
if (gCfgItems.cloud_enable == true)
|
||||
buf_to_wifi[data_offset] = 0x0a;
|
||||
buf_to_wifi[data_offset] = 0x0A;
|
||||
else
|
||||
buf_to_wifi[data_offset] = 0x05;
|
||||
|
||||
buf_to_wifi[data_offset + 1] = urlLen;
|
||||
strncpy(&buf_to_wifi[data_offset + 2], (const char *)uiCfg.cloud_hostUrl, urlLen);
|
||||
buf_to_wifi[data_offset + urlLen + 2] = uiCfg.cloud_port & 0xff;
|
||||
buf_to_wifi[data_offset + urlLen + 3] = (uiCfg.cloud_port >> 8) & 0xff;
|
||||
buf_to_wifi[data_offset + urlLen + 2] = uiCfg.cloud_port & 0xFF;
|
||||
buf_to_wifi[data_offset + urlLen + 3] = (uiCfg.cloud_port >> 8) & 0xFF;
|
||||
buf_to_wifi[data_offset + urlLen + 4] = wifi_ret_tail;
|
||||
|
||||
index_to_wifi = urlLen + 4;
|
||||
|
||||
buf_to_wifi[0] = wifi_ret_head;
|
||||
buf_to_wifi[1] = type;
|
||||
buf_to_wifi[2] = index_to_wifi & 0xff;
|
||||
buf_to_wifi[3] = (index_to_wifi >> 8) & 0xff;
|
||||
buf_to_wifi[2] = index_to_wifi & 0xFF;
|
||||
buf_to_wifi[3] = (index_to_wifi >> 8) & 0xFF;
|
||||
|
||||
raw_send_to_wifi(buf_to_wifi, 5 + index_to_wifi);
|
||||
|
||||
@ -526,8 +526,8 @@ int write_to_file(char *buf, int len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ESP_PROTOC_HEAD (uint8_t)0xa5
|
||||
#define ESP_PROTOC_TAIL (uint8_t)0xfc
|
||||
#define ESP_PROTOC_HEAD (uint8_t)0xA5
|
||||
#define ESP_PROTOC_TAIL (uint8_t)0xFC
|
||||
|
||||
#define ESP_TYPE_NET (uint8_t)0x0
|
||||
#define ESP_TYPE_GCODE (uint8_t)0x1
|
||||
@ -1282,22 +1282,22 @@ void utf8_2_unicode(uint8_t *source,uint8_t Len) {
|
||||
else if (char_byte_num == 0XC0 || char_byte_num == 0XD0) {
|
||||
//--2byte
|
||||
|
||||
u16_h = (((uint16_t)source[i] <<8) & 0x1f00) >> 2;
|
||||
u16_l = ((uint16_t)source[i+1] & 0x003f);
|
||||
u16_h = (((uint16_t)source[i] <<8) & 0x1F00) >> 2;
|
||||
u16_l = ((uint16_t)source[i+1] & 0x003F);
|
||||
u16_value = (u16_h | u16_l);
|
||||
FileName_unicode[char_i] = (uint8_t)((u16_value & 0xff00) >> 8);
|
||||
FileName_unicode[char_i + 1] = (uint8_t)(u16_value & 0x00ff);
|
||||
FileName_unicode[char_i] = (uint8_t)((u16_value & 0xFF00) >> 8);
|
||||
FileName_unicode[char_i + 1] = (uint8_t)(u16_value & 0x00FF);
|
||||
i += 2;
|
||||
char_i += 2;
|
||||
}
|
||||
else if (char_byte_num == 0XE0) {
|
||||
//--3byte
|
||||
u16_h = (((uint16_t)source[i] <<8 ) & 0x0f00) << 4;
|
||||
u16_m = (((uint16_t)source[i+1] << 8) & 0x3f00) >> 2;
|
||||
u16_l = ((uint16_t)source[i+2] & 0x003f);
|
||||
u16_h = (((uint16_t)source[i] <<8 ) & 0x0F00) << 4;
|
||||
u16_m = (((uint16_t)source[i+1] << 8) & 0x3F00) >> 2;
|
||||
u16_l = ((uint16_t)source[i+2] & 0x003F);
|
||||
u16_value = (u16_h | u16_m | u16_l);
|
||||
FileName_unicode[char_i] = (uint8_t)((u16_value & 0xff00) >> 8);
|
||||
FileName_unicode[char_i + 1] = (uint8_t)(u16_value & 0x00ff);
|
||||
FileName_unicode[char_i] = (uint8_t)((u16_value & 0xFF00) >> 8);
|
||||
FileName_unicode[char_i + 1] = (uint8_t)(u16_value & 0x00FF);
|
||||
i += 3;
|
||||
char_i += 2;
|
||||
}
|
||||
|
@ -55,24 +55,24 @@ const uint8_t ESP_MEM_END = 0x06;
|
||||
const uint8_t ESP_MEM_DATA = 0x07;
|
||||
const uint8_t ESP_SYNC = 0x08;
|
||||
const uint8_t ESP_WRITE_REG = 0x09;
|
||||
const uint8_t ESP_READ_REG = 0x0a;
|
||||
const uint8_t ESP_READ_REG = 0x0A;
|
||||
|
||||
// MAC address storage locations
|
||||
const uint32_t ESP_OTP_MAC0 = 0x3ff00050;
|
||||
const uint32_t ESP_OTP_MAC1 = 0x3ff00054;
|
||||
const uint32_t ESP_OTP_MAC2 = 0x3ff00058;
|
||||
const uint32_t ESP_OTP_MAC3 = 0x3ff0005c;
|
||||
const uint32_t ESP_OTP_MAC0 = 0x3FF00050;
|
||||
const uint32_t ESP_OTP_MAC1 = 0x3FF00054;
|
||||
const uint32_t ESP_OTP_MAC2 = 0x3FF00058;
|
||||
const uint32_t ESP_OTP_MAC3 = 0x3FF0005C;
|
||||
|
||||
const size_t EspFlashBlockSize = 0x0400; // 1K byte blocks
|
||||
|
||||
const uint8_t ESP_IMAGE_MAGIC = 0xe9;
|
||||
const uint8_t ESP_CHECKSUM_MAGIC = 0xef;
|
||||
const uint8_t ESP_IMAGE_MAGIC = 0xE9;
|
||||
const uint8_t ESP_CHECKSUM_MAGIC = 0xEF;
|
||||
|
||||
const uint32_t ESP_ERASE_CHIP_ADDR = 0x40004984; // &SPIEraseChip
|
||||
const uint32_t ESP_SEND_PACKET_ADDR = 0x40003c80; // &send_packet
|
||||
const uint32_t ESP_SPI_READ_ADDR = 0x40004b1c; // &SPIRead
|
||||
const uint32_t ESP_SEND_PACKET_ADDR = 0x40003C80; // &send_packet
|
||||
const uint32_t ESP_SPI_READ_ADDR = 0x40004B1C; // &SPIRead
|
||||
const uint32_t ESP_UNKNOWN_ADDR = 0x40001121; // not used
|
||||
const uint32_t ESP_USER_DATA_RAM_ADDR = 0x3ffe8000; // &user data ram
|
||||
const uint32_t ESP_USER_DATA_RAM_ADDR = 0x3FFE8000; // &user data ram
|
||||
const uint32_t ESP_IRAM_ADDR = 0x40100000; // instruction RAM
|
||||
const uint32_t ESP_FLASH_ADDR = 0x40200000; // address of start of Flash
|
||||
//const uint32_t ESP_FLASH_READ_STUB_BEGIN = IRAM_ADDR + 0x18;
|
||||
@ -190,7 +190,7 @@ void putData(uint32_t val, unsigned byteCnt, uint8_t *buf, int ofst) {
|
||||
byteCnt = 4;
|
||||
}
|
||||
do {
|
||||
buf[ofst++] = (uint8_t)(val & 0xff);
|
||||
buf[ofst++] = (uint8_t)(val & 0xFF);
|
||||
val >>= 8;
|
||||
} while (--byteCnt);
|
||||
}
|
||||
@ -201,7 +201,7 @@ void putData(uint32_t val, unsigned byteCnt, uint8_t *buf, int ofst) {
|
||||
// 2 - an escaped byte was read successfully
|
||||
// 1 - a non-escaped byte was read successfully
|
||||
// 0 - no data was available
|
||||
// -1 - the value 0xc0 was encountered (shouldn't happen)
|
||||
// -1 - the value 0xC0 was encountered (shouldn't happen)
|
||||
// -2 - a SLIP escape byte was found but the following byte wasn't available
|
||||
// -3 - a SLIP escape byte was followed by an invalid byte
|
||||
int ReadByte(uint8_t *data, signed char slipDecode) {
|
||||
@ -215,13 +215,13 @@ int ReadByte(uint8_t *data, signed char slipDecode) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (*data == 0xc0) {
|
||||
if (*data == 0xC0) {
|
||||
// this shouldn't happen
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// if not the SLIP escape, we're done
|
||||
if (*data != 0xdb) {
|
||||
if (*data != 0xDB) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -232,13 +232,13 @@ int ReadByte(uint8_t *data, signed char slipDecode) {
|
||||
|
||||
// process the escaped byte
|
||||
*data = uploadPort_read();
|
||||
if (*data == 0xdc) {
|
||||
*data = 0xc0;
|
||||
if (*data == 0xDC) {
|
||||
*data = 0xC0;
|
||||
return(2);
|
||||
}
|
||||
|
||||
if (*data == 0xdd) {
|
||||
*data = 0xdb;
|
||||
if (*data == 0xDD) {
|
||||
*data = 0xDB;
|
||||
return(2);
|
||||
}
|
||||
// invalid
|
||||
@ -325,7 +325,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
|
||||
switch(state) {
|
||||
case begin: // expecting frame start
|
||||
c = uploadPort_read();
|
||||
if (c != (uint8_t)0xc0) {
|
||||
if (c != (uint8_t)0xC0) {
|
||||
break;
|
||||
}
|
||||
state = header;
|
||||
@ -334,7 +334,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
|
||||
break;
|
||||
case end: // expecting frame end
|
||||
c = uploadPort_read();
|
||||
if (c != (uint8_t)0xc0) {
|
||||
if (c != (uint8_t)0xC0) {
|
||||
return slipFrame;
|
||||
}
|
||||
state = done;
|
||||
@ -428,24 +428,24 @@ void _writePacket(const uint8_t *data, size_t len) {
|
||||
}
|
||||
|
||||
// Send a packet to the serial port while performing SLIP framing. The packet data comprises a header and an optional data block.
|
||||
// A SLIP packet begins and ends with 0xc0. The data encapsulated has the bytes
|
||||
// 0xc0 and 0xdb replaced by the two-byte sequences {0xdb, 0xdc} and {0xdb, 0xdd} respectively.
|
||||
// A SLIP packet begins and ends with 0xC0. The data encapsulated has the bytes
|
||||
// 0xC0 and 0xDB replaced by the two-byte sequences {0xDB, 0xDC} and {0xDB, 0xDD} respectively.
|
||||
|
||||
void writePacket(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) {
|
||||
|
||||
WriteByteRaw(0xc0); // send the packet start character
|
||||
WriteByteRaw(0xC0); // send the packet start character
|
||||
_writePacket(hdr, hdrLen); // send the header
|
||||
_writePacket(data, dataLen); // send the data block
|
||||
WriteByteRaw(0xc0); // send the packet end character
|
||||
WriteByteRaw(0xC0); // send the packet end character
|
||||
}
|
||||
|
||||
// Send a packet to the serial port while performing SLIP framing. The packet data comprises a header and an optional data block.
|
||||
// This is like writePacket except that it does a fast block write for both the header and the main data with no SLIP encoding. Used to send sync commands.
|
||||
void writePacketRaw(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) {
|
||||
WriteByteRaw(0xc0); // send the packet start character
|
||||
WriteByteRaw(0xC0); // send the packet start character
|
||||
_writePacketRaw(hdr, hdrLen); // send the header
|
||||
_writePacketRaw(data, dataLen); // send the data block in raw mode
|
||||
WriteByteRaw(0xc0); // send the packet end character
|
||||
WriteByteRaw(0xC0); // send the packet end character
|
||||
}
|
||||
|
||||
// Send a command to the attached device together with the supplied data, if any.
|
||||
@ -585,7 +585,7 @@ EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) {
|
||||
if (cnt != blkSize) {
|
||||
if (f_tell(&esp_upload.uploadFile) == esp_upload.fileSize) {
|
||||
// partial last block, fill the remainder
|
||||
memset(blkBuf + dataOfst + cnt, 0xff, blkSize - cnt);
|
||||
memset(blkBuf + dataOfst + cnt, 0xFF, blkSize - cnt);
|
||||
}
|
||||
else {
|
||||
return fileRead;
|
||||
|
Reference in New Issue
Block a user