Skip to content

Commit 0846a41

Browse files
committed
Fix examples
1 parent 5cf83b1 commit 0846a41

File tree

39 files changed

+65
-75
lines changed

39 files changed

+65
-75
lines changed

libraries/BLE/examples/BLE_Beacon_Scanner/BLE_Beacon_Scanner.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
118118
int temp = (int)payLoad[16] + (int)(payLoad[15] << 8);
119119
float calcTemp = temp / 256.0f;
120120
Serial.printf("Reported temperature from data: %.2fC\n", calcTemp);
121-
Serial.printf("Reported advertise count: %d\n", foundEddyURL.getCount());
122-
Serial.printf("Reported time since last reboot: %ds\n", foundEddyURL.getTime());
121+
Serial.printf("Reported advertise count: %lu\n", foundEddyURL.getCount());
122+
Serial.printf("Reported time since last reboot: %lus\n", foundEddyURL.getTime());
123123
Serial.println("\n");
124124
Serial.print(foundEddyURL.toString().c_str());
125125
Serial.println("\n");

libraries/BLE/examples/BLE_EddystoneTLM_Beacon/BLE_EddystoneTLM_Beacon.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ void setup()
8686
Serial.begin(115200);
8787
gettimeofday(&nowTimeStruct, NULL);
8888

89-
Serial.printf("start ESP32 %d\n", bootcount++);
89+
Serial.printf("start ESP32 %lu\n", bootcount++);
9090

91-
Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n", nowTimeStruct.tv_sec, nowTimeStruct.tv_sec - last);
91+
Serial.printf("deep sleep (%llds since last reset, %llds since last boot)\n", nowTimeStruct.tv_sec, nowTimeStruct.tv_sec - last);
9292

9393
last = nowTimeStruct.tv_sec;
9494
lastTenth = nowTimeStruct.tv_sec * 10; // Time since last reset as 0.1 second resolution counter

libraries/BLE/examples/BLE_EddystoneURL_Beacon/BLE_EddystoneURL_Beacon.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ void setup()
160160
Serial.begin(115200);
161161
gettimeofday(&now, NULL);
162162

163-
Serial.printf("start ESP32 %d\n", bootcount++);
163+
Serial.printf("start ESP32 %lu\n", bootcount++);
164164

165-
Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n", now.tv_sec, now.tv_sec - last);
165+
Serial.printf("deep sleep (%llds since last reset, %llds since last boot)\n", now.tv_sec, now.tv_sec - last);
166166

167167
last = now.tv_sec;
168168

libraries/EEPROM/examples/eeprom_extra/eeprom_extra.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ void setup() {
107107

108108
value = 0;
109109
value = EEPROM.readLong64(value);
110-
Serial.printf("0x%08X", (uint32_t)(value >> 32)); // Print High 4 bytes in HEX
111-
Serial.printf("%08X\n", (uint32_t)value); // Print Low 4 bytes in HEX
110+
Serial.printf("0x%08lX", (uint32_t)(value >> 32)); // Print High 4 bytes in HEX
111+
Serial.printf("%08lX\n", (uint32_t)value); // Print Low 4 bytes in HEX
112112
address += sizeof(int64_t);
113113

114114
Value = 0; // Clear Value
115115
Value = EEPROM.readULong64(Value);
116-
Serial.printf("0x%08X", (uint32_t)(Value >> 32)); // Print High 4 bytes in HEX
117-
Serial.printf("%08X\n", (uint32_t)Value); // Print Low 4 bytes in HEX
116+
Serial.printf("0x%08lX", (uint32_t)(Value >> 32)); // Print High 4 bytes in HEX
117+
Serial.printf("%08lX\n", (uint32_t)Value); // Print Low 4 bytes in HEX
118118
address += sizeof(uint64_t);
119119

120120
Serial.println(EEPROM.readFloat(address), 4);

libraries/ESP32/examples/AnalogOut/ledcFrequency/ledcFrequency.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ void setup() {
1919
uint32_t max_frequency;
2020
uint32_t frequency;
2121
uint32_t successful_frequency;
22-
uint32_t max_freq_array[SOC_LEDC_TIMER_BIT_WIDE_NUM];
23-
uint32_t min_freq_array[SOC_LEDC_TIMER_BIT_WIDE_NUM];
22+
uint32_t max_freq_array[SOC_LEDC_TIMER_BIT_WIDTH];
23+
uint32_t min_freq_array[SOC_LEDC_TIMER_BIT_WIDTH];
2424

2525
// Find Max Frequency
26-
for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDE_NUM; ++resolution){
26+
for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDTH; ++resolution){
2727
max_freq_array[resolution-1] = 0;
2828
min_frequency = 0;
2929
max_frequency = UINT32_MAX;
@@ -41,7 +41,7 @@ void setup() {
4141
} // for all resolutions
4242

4343
// Find Min Frequency
44-
for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDE_NUM; ++resolution){
44+
for(uint8_t resolution = 1; resolution <= SOC_LEDC_TIMER_BIT_WIDTH; ++resolution){
4545
min_freq_array[resolution-1] = 0;
4646
min_frequency = 0;
4747
max_frequency = max_freq_array[resolution-1];
@@ -59,9 +59,9 @@ void setup() {
5959
} // for all resolutions
6060

6161
printf("Bit resolution | Min Frequency [Hz] | Max Frequency [Hz]\n");
62-
for(uint8_t r = 1; r <= SOC_LEDC_TIMER_BIT_WIDE_NUM; ++r){
62+
for(uint8_t r = 1; r <= SOC_LEDC_TIMER_BIT_WIDTH; ++r){
6363
size_t max_len = std::to_string(UINT32_MAX).length();
64-
printf(" %s%d | %s%u | %s%u\n",
64+
printf(" %s%d | %s%lu | %s%lu\n",
6565
std::string (2 - std::to_string(r).length(), ' ').c_str(), r,
6666
std::string (max_len - std::to_string(min_freq_array[r-1]).length(), ' ').c_str(),
6767
min_freq_array[r-1],

libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static esp_err_t bmp_handler(httpd_req_t *req)
313313
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
314314

315315
char ts[32];
316-
snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);
316+
snprintf(ts, 32, "%lld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);
317317
httpd_resp_set_hdr(req, "X-Timestamp", (const char *)ts);
318318

319319

@@ -379,7 +379,7 @@ static esp_err_t capture_handler(httpd_req_t *req)
379379
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
380380

381381
char ts[32];
382-
snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);
382+
snprintf(ts, 32, "%lld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);
383383
httpd_resp_set_hdr(req, "X-Timestamp", (const char *)ts);
384384

385385
#if CONFIG_ESP_FACE_DETECT_ENABLED

libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/SmoothBlink_ULP_Code.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <Arduino.h>
99
#include "esp32/ulp.h"
1010
#include "driver/rtc_io.h"
11+
#include "soc/rtc_io_reg.h"
1112

1213
// RTC Memory used for ULP internal variable and Sketch interfacing
1314
#define RTC_dutyMeter 0
@@ -143,7 +144,7 @@ void setup() {
143144
while (!Serial) {} // wait for Serial to start
144145

145146
ulp_setup(); // it really only runs on the first ESP32 boot
146-
Serial.printf("\nStarted smooth blink with delay %d\n", *fadeCycleDelay);
147+
Serial.printf("\nStarted smooth blink with delay %ld\n", *fadeCycleDelay);
147148

148149
// *fadeCycleDelay resides in RTC_SLOW_MEM and persists along deep sleep waking up
149150
// it is used as a delay time parameter for smooth blinking, in the ULP processing code

libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ void setup() {
7878
}
7979

8080
// callback when data is recv from Master
81-
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
81+
void OnDataRecv(const esp_now_recv_info_t * info, const uint8_t *data, int data_len) {
8282
char macStr[18];
8383
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
84-
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
84+
info->src_addr[0], info->src_addr[1], info->src_addr[2], info->src_addr[3], info->src_addr[4], info->src_addr[5]);
8585
Serial.print("Last Packet Recv from: "); Serial.println(macStr);
8686
Serial.print("Last Packet Recv Data: "); Serial.println(*data);
8787
Serial.println("");

libraries/ESP32/examples/ESPNow/Multi-Slave/Slave/Slave.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ void setup() {
8080
}
8181

8282
// callback when data is recv from Master
83-
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
83+
void OnDataRecv(const esp_now_recv_info_t * info, const uint8_t *data, int data_len) {
8484
char macStr[18];
8585
snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
86-
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
86+
info->src_addr[0], info->src_addr[1], info->src_addr[2], info->src_addr[3], info->src_addr[4], info->src_addr[5]);
8787
Serial.print("Last Packet Recv from: "); Serial.println(macStr);
8888
Serial.print("Last Packet Recv Data: "); Serial.println(*data);
8989
Serial.println("");

libraries/ESP32/examples/GPIO/FunctionalInterrupt/FunctionalInterrupt.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public:
2222

2323
void checkPressed() {
2424
if (pressed) {
25-
Serial.printf("Button on pin %u has been pressed %u times\n", PIN, numberKeyPresses);
25+
Serial.printf("Button on pin %u has been pressed %lu times\n", PIN, numberKeyPresses);
2626
pressed = false;
2727
}
2828
}

0 commit comments

Comments
 (0)