Skip to content

Commit b1a425b

Browse files
Update OTA_OLED.ino
1 parent 2d4c6f4 commit b1a425b

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

examples/OLED/OTA_OLED/OTA_OLED.ino

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* - Timer test and some other Arduino basic functions.
1616
*
1717
* by lxyzn from HelTec AutoMation, ChengDu, China
18-
* 成都惠利特自动化科技有限公司
18+
* 成都惠利特自动化科技有限公司¸
1919
* www.heltec.cn
2020
*
2121
* This project is also available on GitHub:
@@ -29,19 +29,17 @@
2929
#include "heltec.h"
3030

3131

32-
/********************************************** WIFI Client 注意编译时要设置此�*********************************
32+
/********************************************** WIFI Client 注意编译时要设置此�*********************************
3333
* wifi client
3434
*/
3535
const char* ssid = "xxxxxx"; //replace "xxxxxx" with your WIFI's ssid
3636
const char* password = "xxxxxx"; //replace "xxxxxx" with your WIFI's password
3737

38-
//WiFi&OTA 参数
38+
//WiFi&OTA 参数
3939
//#define HOSTNAME "HelTec_OTA_OLED"
4040
#define PASSWORD "HT.123456" //the password for OTA upgrade, can set it in any char you want
4141

42-
/************************************************ 注意编译时要设置此�*********************************
43-
* 是否使用静态IP
44-
*/
42+
4543
#define USE_STATIC_IP false
4644
#if USE_STATIC_IP
4745
IPAddress staticIP(192,168,1,22);
@@ -54,13 +52,13 @@ const char* password = "xxxxxx"; //replace "xxxxxx" with your WIFI's password
5452
/*******************************************************************
5553
* OLED Arguments
5654
*/
57-
//#define RST_OLED 16 //OLED Reset引脚,需要手动Reset,否则不显示
58-
#define OLED_UPDATE_INTERVAL 500 //OLED屏幕刷新间隔ms
59-
//SSD1306 display(0x3C, 4, 15); //引脚4�5是绑定在Kit 32的主板上的,不能做其它用
55+
//#define RST_OLED 16 //OLED Reset引脚,需要手动Reset,否则不显示
56+
#define OLED_UPDATE_INTERVAL 500 //OLED屏幕刷新间隔ms
57+
//SSD1306 display(0x3C, 4, 15); //引脚4�5是绑定在Kit 32的主板上的,不能做其它用
6058

6159

6260
/********************************************************************
63-
* OTA升级配置
61+
* OTA升级配置
6462
*/
6563
void setupOTA()
6664
{
@@ -80,8 +78,8 @@ void setupOTA()
8078
ArduinoOTA.onStart([]()
8179
{
8280
Heltec.display->clear();
83-
Heltec.display->setFont(ArialMT_Plain_10); //设置字体大小
84-
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);//设置字体对齐方式
81+
Heltec.display->setFont(ArialMT_Plain_10); //设置字体大小
82+
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);//设置字体对齐方式
8583
Heltec.display->drawString(0, 0, "Start Updating....");
8684

8785
Serial.printf("Start Updating....Type:%s\n", (ArduinoOTA.getCommand() == U_FLASH) ? "sketch" : "filesystem");
@@ -168,22 +166,22 @@ void setupWIFI()
168166
Heltec.display->drawString(0, 10, String(ssid));
169167
Heltec.display->display();
170168

171-
//连接WiFi,删除旧的配置,关闭WIFI,准备重新配�
169+
//连接WiFi,删除旧的配置,关闭WIFI,准备重新配�
172170
WiFi.disconnect(true);
173171
delay(1000);
174172

175173
WiFi.mode(WIFI_STA);
176174
//WiFi.onEvent(WiFiEvent);
177175
WiFi.setAutoConnect(true);
178-
WiFi.setAutoReconnect(true); //断开WiFi后自动重新连�ESP32不可�
176+
WiFi.setAutoReconnect(true); //断开WiFi后自动重新连�ESP32不可�
179177
//WiFi.setHostname(HOSTNAME);
180178
WiFi.begin(ssid, password);
181179
#if USE_STATIC_IP
182180
WiFi.config(staticIP, gateway, subnet);
183181
#endif
184182

185-
//等待5000ms,如果没有连接上,就继续往�
186-
//不然基本功能不可�
183+
//等待5000ms,如果没有连接上,就继续往�
184+
//不然基本功能不可�
187185
byte count = 0;
188186
while(WiFi.status() != WL_CONNECTED && count < 10)
189187
{
@@ -228,12 +226,12 @@ void loop()
228226
unsigned long ms = millis();
229227
if(ms % 1000 == 0)
230228
{
231-
Serial.println("hello,OTA now");
229+
Serial.println("hello,OTA now");
232230
}
233231
}
234232

235233
/****************************************************
236-
* [通用函数]ESP32 WiFi Kit 32事件处理
234+
* [通用函数]ESP32 WiFi Kit 32事件处理
237235
*/
238236
void WiFiEvent(WiFiEvent_t event)
239237
{

0 commit comments

Comments
 (0)