allow the examples to build in a more strict env (#3299)

This commit is contained in:
Me No Dev 2019-09-29 23:47:02 +03:00 committed by GitHub
parent 5bff89f0be
commit 1c77790a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 31 additions and 36 deletions

View File

@ -87,6 +87,7 @@ bool connectToServer() {
pRemoteCharacteristic->registerForNotify(notifyCallback);
connected = true;
return true;
}
/**
* Scan for BLE servers and find the first one that advertises the service we are looking for.

View File

@ -693,15 +693,13 @@ void BLECharacteristic::setValue(int& data32) {
} // setValue
void BLECharacteristic::setValue(float& data32) {
uint8_t temp[4];
*((float*)temp) = data32;
setValue(temp, 4);
float temp = data32;
setValue((uint8_t*)&temp, 4);
} // setValue
void BLECharacteristic::setValue(double& data64) {
uint8_t temp[8];
*((double*)temp) = data64;
setValue(temp, 8);
double temp = data64;
setValue((uint8_t*)&temp, 8);
} // setValue

View File

@ -104,11 +104,10 @@ bool GeneralUtils::base64Encode(const std::string& in, std::string* out) {
* * Amount of free RAM
*/
void GeneralUtils::dumpInfo() {
size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_8BIT);
esp_chip_info_t chipInfo;
esp_chip_info(&chipInfo);
log_v("--- dumpInfo ---");
log_v("Free heap: %d", freeHeap);
log_v("Free heap: %d", heap_caps_get_free_size(MALLOC_CAP_8BIT));
log_v("Chip Info: Model: %d, cores: %d, revision: %d", chipInfo.model, chipInfo.cores, chipInfo.revision);
log_v("ESP-IDF version: %s", esp_get_idf_version());
log_v("---");

View File

@ -37,7 +37,8 @@ void setup() {
ESP.restart();
}
char* name = "Teo Swee Ann";
const char* name = "Teo Swee Ann";
char rname[32];
double height = 5.8;
uint32_t age = 47;
@ -60,10 +61,10 @@ void setup() {
Serial.println("------------------------------------\n");
// Read: Variables <--- EEPROM stores
NAMES.get(0, name);
NAMES.get(0, rname);
HEIGHT.get(0, height);
AGE.get(0, age);
Serial.print("name: "); Serial.println(name);
Serial.print("name: "); Serial.println(rname);
Serial.print("height: "); Serial.println(height);
Serial.print("age: "); Serial.println(age);

View File

@ -49,11 +49,11 @@ void setup() {
EEPROM.writeULong(address, 4294967295); // Same as writeUInt and readUInt
address += sizeof(unsigned long);
int64_t value = -9223372036854775808; // -2^63
int64_t value = -1223372036854775808LL; // -2^63
EEPROM.writeLong64(address, value);
address += sizeof(int64_t);
uint64_t Value = 18446744073709551615; // 2^64 - 1
uint64_t Value = 18446744073709551615ULL; // 2^64 - 1
EEPROM.writeULong64(address, Value);
address += sizeof(uint64_t);

View File

@ -40,8 +40,6 @@ Method to print the touchpad by which ESP32
has been awaken from sleep
*/
void print_wakeup_touchpad(){
touch_pad_t pin;
touchPin = esp_sleep_get_touchpad_wakeup_status();
switch(touchPin)

View File

@ -88,7 +88,7 @@ void ScanForSlave() {
Serial.print(i + 1); Serial.print(": "); Serial.print(SSID); Serial.print(" ["); Serial.print(BSSIDstr); Serial.print("]"); Serial.print(" ("); Serial.print(RSSI); Serial.print(")"); Serial.println("");
// Get BSSID => Mac Address of the Slave
int mac[6];
if ( 6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x%c", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5] ) ) {
if ( 6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5] ) ) {
for (int ii = 0; ii < 6; ++ii ) {
slave.peer_addr[ii] = (uint8_t) mac[ii];
}
@ -124,17 +124,15 @@ bool manageSlave() {
}
Serial.print("Slave Status: ");
const esp_now_peer_info_t *peer = &slave;
const uint8_t *peer_addr = slave.peer_addr;
// check if the peer exists
bool exists = esp_now_is_peer_exist(peer_addr);
bool exists = esp_now_is_peer_exist(slave.peer_addr);
if ( exists) {
// Slave already paired.
Serial.println("Already Paired");
return true;
} else {
// Slave not paired, attempt pair
esp_err_t addStatus = esp_now_add_peer(peer);
esp_err_t addStatus = esp_now_add_peer(&slave);
if (addStatus == ESP_OK) {
// Pair success
Serial.println("Pair success");
@ -168,9 +166,7 @@ bool manageSlave() {
}
void deletePeer() {
const esp_now_peer_info_t *peer = &slave;
const uint8_t *peer_addr = slave.peer_addr;
esp_err_t delStatus = esp_now_del_peer(peer_addr);
esp_err_t delStatus = esp_now_del_peer(slave.peer_addr);
Serial.print("Slave Delete Status: ");
if (delStatus == ESP_OK) {
// Delete success

View File

@ -100,7 +100,7 @@ void ScanForSlave() {
// Get BSSID => Mac Address of the Slave
int mac[6];
if ( 6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x%c", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5] ) ) {
if ( 6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5] ) ) {
for (int ii = 0; ii < 6; ++ii ) {
slaves[SlaveCnt].peer_addr[ii] = (uint8_t) mac[ii];
}
@ -127,8 +127,6 @@ void ScanForSlave() {
void manageSlave() {
if (SlaveCnt > 0) {
for (int i = 0; i < SlaveCnt; i++) {
const esp_now_peer_info_t *peer = &slaves[i];
const uint8_t *peer_addr = slaves[i].peer_addr;
Serial.print("Processing: ");
for (int ii = 0; ii < 6; ++ii ) {
Serial.print((uint8_t) slaves[i].peer_addr[ii], HEX);
@ -136,13 +134,13 @@ void manageSlave() {
}
Serial.print(" Status: ");
// check if the peer exists
bool exists = esp_now_is_peer_exist(peer_addr);
bool exists = esp_now_is_peer_exist(slaves[i].peer_addr);
if (exists) {
// Slave already paired.
Serial.println("Already Paired");
} else {
// Slave not paired, attempt pair
esp_err_t addStatus = esp_now_add_peer(peer);
esp_err_t addStatus = esp_now_add_peer(&slaves[i]);
if (addStatus == ESP_OK) {
// Pair success
Serial.println("Pair success");

View File

@ -52,7 +52,7 @@ void loop()
// Printout the received data plus the original values
for (i=0; i<60; i++)
{
Serial.printf("%08x=%08x ", my_data[i], data[i] );
Serial.printf("%08x=%08x ", my_data[i].val, data[i].val );
if (!((i+1)%4)) Serial.println("\n");
}
Serial.println("\n");

View File

@ -141,7 +141,6 @@ static bool xjtReceiveBit(size_t index, bool bit){
}
void parseRmt(rmt_data_t* items, size_t len, uint32_t* channels){
size_t chan = 0;
bool valid = true;
rmt_data_t* it = NULL;

View File

@ -165,8 +165,8 @@ void setup(){
return;
}
Serial.printf("Total space: %10lu\n", FFat.totalBytes());
Serial.printf("Free space: %10lu\n", FFat.freeBytes());
Serial.printf("Total space: %10u\n", FFat.totalBytes());
Serial.printf("Free space: %10u\n", FFat.freeBytes());
listDir(FFat, "/", 0);
writeFile(FFat, "/hello.txt", "Hello ");
appendFile(FFat, "/hello.txt", "World!\r\n");
@ -175,7 +175,7 @@ void setup(){
readFile(FFat, "/foo.txt");
deleteFile(FFat, "/foo.txt");
testFileIO(FFat, "/test.txt");
Serial.printf("Free space: %10lu\n", FFat.freeBytes());
Serial.printf("Free space: %10u\n", FFat.freeBytes());
deleteFile(FFat, "/test.txt");
Serial.println( "Test complete" );
}

View File

@ -10,6 +10,9 @@
* ETH_CLOCK_GPIO16_OUT - 50MHz clock from internal APLL output on GPIO16 - possibly an inverter is needed for LAN8720
* ETH_CLOCK_GPIO17_OUT - 50MHz clock from internal APLL inverted output on GPIO17 - tested with LAN8720
*/
#ifdef ETH_CLK_MODE
#undef ETH_CLK_MODE
#endif
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)

View File

@ -121,6 +121,7 @@ void WiFiEvent(WiFiEvent_t event)
case SYSTEM_EVENT_ETH_GOT_IP:
Serial.println("Obtained IP address");
break;
default: break;
}}
void WiFiGotIP(WiFiEvent_t event, WiFiEventInfo_t info)

View File

@ -34,7 +34,7 @@ void loop(){
if(connected){
//Send a packet
udp.beginPacket(udpAddress,udpPort);
udp.printf("Seconds since boot: %u", millis()/1000);
udp.printf("Seconds since boot: %lu", millis()/1000);
udp.endPacket();
}
//Wait for 1 second
@ -71,5 +71,6 @@ void WiFiEvent(WiFiEvent_t event){
Serial.println("WiFi lost connection");
connected = false;
break;
default: break;
}
}

View File

@ -25,10 +25,10 @@ compiler.sdk.path={runtime.platform.path}/tools/sdk
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/app_trace" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/asio" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/esp_adc_cal" "-I{compiler.sdk.path}/include/esp_event" "-I{compiler.sdk.path}/include/esp_http_client" "-I{compiler.sdk.path}/include/esp_http_server" "-I{compiler.sdk.path}/include/esp_https_ota" "-I{compiler.sdk.path}/include/esp_ringbuf" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freemodbus" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/heap" "-I{compiler.sdk.path}/include/idf_test" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/libsodium" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/lwip" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/micro-ecc" "-I{compiler.sdk.path}/include/mqtt" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/protobuf-c" "-I{compiler.sdk.path}/include/protocomm" "-I{compiler.sdk.path}/include/pthread" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/smartconfig_ack" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/spiffs" "-I{compiler.sdk.path}/include/tcp_transport" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/wear_levelling" "-I{compiler.sdk.path}/include/wifi_provisioning" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/esp32-camera" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/fb_gfx"
compiler.c.cmd=xtensa-esp32-elf-gcc
compiler.c.flags=-std=gnu99 -Os -g3 -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wpointer-arith {compiler.warning_flags} -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -MMD -c
compiler.c.flags=-std=gnu99 -Os -g3 -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wpointer-arith {compiler.warning_flags} -Wno-maybe-uninitialized -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -MMD -c
compiler.cpp.cmd=xtensa-esp32-elf-g++
compiler.cpp.flags=-std=gnu++11 -fno-exceptions -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib {compiler.warning_flags} -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -fno-rtti -MMD -c
compiler.cpp.flags=-std=gnu++11 -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib {compiler.warning_flags} -Wno-error=maybe-uninitialized -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-missing-field-initializers -Wno-sign-compare -fno-rtti -MMD -c
compiler.S.cmd=xtensa-esp32-elf-gcc
compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls