Unverified Commit f42cba9a authored by Me No Dev's avatar Me No Dev Committed by GitHub

Merge branch 'master' into release/v2.x

parents d3254f75 758b4ebf
...@@ -41,6 +41,7 @@ body: ...@@ -41,6 +41,7 @@ body:
options: options:
- latest master (checkout manually) - latest master (checkout manually)
- latest development Release Candidate (RC-X) - latest development Release Candidate (RC-X)
- v2.0.8
- v2.0.7 - v2.0.7
- v2.0.6 - v2.0.6
- v2.0.5 - v2.0.5
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
"name": "ESP32Servo", "name": "ESP32Servo",
"exclude_targets": [], "exclude_targets": [],
"sketch_path": [ "sketch_path": [
"~/Arduino/libraries/ESP32Servo/examples/Knob/Knob.ino",
"~/Arduino/libraries/ESP32Servo/examples/Sweep/Sweep.ino",
"~/Arduino/libraries/ESP32Servo/examples/PWMExample/PWMExample.ino",
"~/Arduino/libraries/ESP32Servo/examples/Multiple-Servo-Example-Arduino/Multiple-Servo-Example-Arduino.ino" "~/Arduino/libraries/ESP32Servo/examples/Multiple-Servo-Example-Arduino/Multiple-Servo-Example-Arduino.ino"
] ]
}, },
...@@ -51,5 +48,19 @@ ...@@ -51,5 +48,19 @@
"sketch_path": [ "sketch_path": [
"~/Arduino/libraries/IRremote/examples/SendDemo/SendDemo.ino" "~/Arduino/libraries/IRremote/examples/SendDemo/SendDemo.ino"
] ]
},
{
"name": "MFRC522",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/MFRC522/examples/ReadUidMultiReader/ReadUidMultiReader.ino"
]
},
{
"name": "WS2812FX",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/WS2812FX/examples/ws2812fx_spi/ws2812fx_spi.ino"
]
} }
] ]
\ No newline at end of file
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
// A pure abstract class forward used as a means to proide a unique pointer type // A pure abstract class forward used as a means to proide a unique pointer type
// but really is never defined. // but really is never defined.
class __FlashStringHelper; class __FlashStringHelper;
#define FPSTR(pstr_pointer) (pstr_pointer) #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
#define F(string_literal) (string_literal) #define F(string_literal) (FPSTR(PSTR(string_literal)))
// An inherited class for holding the result of a concatenation. These // An inherited class for holding the result of a concatenation. These
// result objects are assumed to be writable by subsequent concatenations. // result objects are assumed to be writable by subsequent concatenations.
......
...@@ -215,26 +215,32 @@ static int cnt_channel = LEDC_CHANNELS; ...@@ -215,26 +215,32 @@ static int cnt_channel = LEDC_CHANNELS;
static uint8_t analog_resolution = 8; static uint8_t analog_resolution = 8;
static int analog_frequency = 1000; static int analog_frequency = 1000;
void analogWrite(uint8_t pin, int value) { void analogWrite(uint8_t pin, int value) {
// Use ledc hardware for internal pins // Use ledc hardware for internal pins
if (pin < SOC_GPIO_PIN_COUNT) { if (pin < SOC_GPIO_PIN_COUNT) {
if (pin_to_channel[pin] == 0) { int8_t channel = -1;
if (!cnt_channel) { if (pin_to_channel[pin] == 0) {
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS); if (!cnt_channel) {
return; log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
} return;
if(ledcSetup(cnt_channel - 1, analog_frequency, analog_resolution) == 0){ }
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency"); cnt_channel--;
return; channel = cnt_channel;
} } else {
ledcAttachPin(pin, cnt_channel - 1); channel = analogGetChannel(pin);
pin_to_channel[pin] = cnt_channel--; }
log_v("GPIO %d - Using Channel %d, Value = %d", pin, channel, value);
if(ledcSetup(channel, analog_frequency, analog_resolution) == 0){
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
return;
}
ledcAttachPin(pin, channel);
pin_to_channel[pin] = channel;
ledcWrite(channel, value);
} }
ledcWrite(pin_to_channel[pin] - 1, value);
}
} }
int8_t analogGetChannel(uint8_t pin) { int8_t analogGetChannel(uint8_t pin) {
return pin_to_channel[pin] - 1; return pin_to_channel[pin];
} }
void analogWriteFrequency(uint32_t freq) { void analogWriteFrequency(uint32_t freq) {
......
...@@ -60,8 +60,8 @@ void setup() { ...@@ -60,8 +60,8 @@ void setup() {
config.pin_pclk = PCLK_GPIO_NUM; config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM; config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM; config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM; config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000; config.xclk_freq_hz = 20000000;
......
...@@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap) ...@@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
return false; return false;
} }
/**
* @brief Reset WiFi settings in NVS to default values.
* @return true if erase succeeded
* @note: Resets SSID, password, protocol, mode, etc.
* These settings are maintained by WiFi driver in IDF.
* WiFi driver must be initialized.
*/
bool WiFiSTAClass::eraseAP(void) {
if(WiFi.getMode()==WIFI_MODE_NULL) {
if(!WiFi.enableSTA(true))
return false;
}
return esp_wifi_restore()==ESP_OK;
}
/** /**
* Change IP configuration settings disabling the dhcp client * Change IP configuration settings disabling the dhcp client
* @param local_ip Static ip configuration * @param local_ip Static ip configuration
......
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
bool reconnect(); bool reconnect();
bool disconnect(bool wifioff = false, bool eraseap = false); bool disconnect(bool wifioff = false, bool eraseap = false);
bool eraseAP(void);
bool isConnected(); bool isConnected();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment