mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-27 21:16:50 +03:00
Use direct member initialization instead of ctr initialisation (#7556)
This removes a bit of code repetition.
This commit is contained in:
parent
c366f84520
commit
59873908c4
@ -31,19 +31,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ArduinoOTAClass::ArduinoOTAClass()
|
ArduinoOTAClass::ArduinoOTAClass()
|
||||||
: _port(0)
|
|
||||||
, _udp_ota(0)
|
|
||||||
, _initialized(false)
|
|
||||||
, _rebootOnSuccess(true)
|
|
||||||
, _useMDNS(true)
|
|
||||||
, _state(OTA_IDLE)
|
|
||||||
, _size(0)
|
|
||||||
, _cmd(0)
|
|
||||||
, _ota_port(0)
|
|
||||||
, _start_callback(NULL)
|
|
||||||
, _end_callback(NULL)
|
|
||||||
, _error_callback(NULL)
|
|
||||||
, _progress_callback(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,31 +69,31 @@ class ArduinoOTAClass
|
|||||||
int getCommand();
|
int getCommand();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _port;
|
|
||||||
String _password;
|
|
||||||
String _hostname;
|
|
||||||
String _nonce;
|
|
||||||
UdpContext *_udp_ota;
|
|
||||||
bool _initialized;
|
|
||||||
bool _rebootOnSuccess;
|
|
||||||
bool _useMDNS;
|
|
||||||
ota_state_t _state;
|
|
||||||
int _size;
|
|
||||||
int _cmd;
|
|
||||||
uint16_t _ota_port;
|
|
||||||
uint16_t _ota_udp_port;
|
|
||||||
IPAddress _ota_ip;
|
|
||||||
String _md5;
|
|
||||||
|
|
||||||
THandlerFunction _start_callback;
|
|
||||||
THandlerFunction _end_callback;
|
|
||||||
THandlerFunction_Error _error_callback;
|
|
||||||
THandlerFunction_Progress _progress_callback;
|
|
||||||
|
|
||||||
void _runUpdate(void);
|
void _runUpdate(void);
|
||||||
void _onRx(void);
|
void _onRx(void);
|
||||||
int parseInt(void);
|
int parseInt(void);
|
||||||
String readStringUntil(char end);
|
String readStringUntil(char end);
|
||||||
|
|
||||||
|
int _port = 0;
|
||||||
|
String _password;
|
||||||
|
String _hostname;
|
||||||
|
String _nonce;
|
||||||
|
UdpContext *_udp_ota = nullptr;
|
||||||
|
bool _initialized = false;
|
||||||
|
bool _rebootOnSuccess = true;
|
||||||
|
bool _useMDNS = true;
|
||||||
|
ota_state_t _state = OTA_IDLE;
|
||||||
|
int _size = 0;
|
||||||
|
int _cmd = 0;
|
||||||
|
uint16_t _ota_port = 0;
|
||||||
|
uint16_t _ota_udp_port = 0;
|
||||||
|
IPAddress _ota_ip;
|
||||||
|
String _md5;
|
||||||
|
|
||||||
|
THandlerFunction _start_callback = nullptr;
|
||||||
|
THandlerFunction _end_callback = nullptr;
|
||||||
|
THandlerFunction_Error _error_callback = nullptr;
|
||||||
|
THandlerFunction_Progress _progress_callback = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_ARDUINOOTA)
|
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_ARDUINOOTA)
|
||||||
|
@ -30,12 +30,12 @@ extern "C" uint32_t _FS_start;
|
|||||||
extern "C" uint32_t _FS_end;
|
extern "C" uint32_t _FS_end;
|
||||||
|
|
||||||
ESP8266HTTPUpdate::ESP8266HTTPUpdate(void)
|
ESP8266HTTPUpdate::ESP8266HTTPUpdate(void)
|
||||||
: _httpClientTimeout(8000), _followRedirects(HTTPC_DISABLE_FOLLOW_REDIRECTS), _ledPin(-1)
|
: _httpClientTimeout(8000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP8266HTTPUpdate::ESP8266HTTPUpdate(int httpClientTimeout)
|
ESP8266HTTPUpdate::ESP8266HTTPUpdate(int httpClientTimeout)
|
||||||
: _httpClientTimeout(httpClientTimeout), _followRedirects(HTTPC_DISABLE_FOLLOW_REDIRECTS), _ledPin(-1)
|
: _httpClientTimeout(httpClientTimeout)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int _httpClientTimeout;
|
int _httpClientTimeout;
|
||||||
followRedirects_t _followRedirects;
|
followRedirects_t _followRedirects = HTTPC_DISABLE_FOLLOW_REDIRECTS;
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
HTTPUpdateStartCB _cbStart;
|
HTTPUpdateStartCB _cbStart;
|
||||||
@ -192,7 +192,7 @@ private:
|
|||||||
HTTPUpdateErrorCB _cbError;
|
HTTPUpdateErrorCB _cbError;
|
||||||
HTTPUpdateProgressCB _cbProgress;
|
HTTPUpdateProgressCB _cbProgress;
|
||||||
|
|
||||||
int _ledPin;
|
int _ledPin = -1;
|
||||||
uint8_t _ledOn;
|
uint8_t _ledOn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user