IDF v5 compatibility

This commit is contained in:
Edward Firmo
2023-12-03 13:26:44 +01:00
parent f1c5ae505e
commit 647c56920e

View File

@@ -70,7 +70,7 @@ api:
display: display:
- id: !extend disp1 - id: !extend disp1
#tft_url: ${nextion_update_url} tft_url: ${nextion_update_url}
script: script:
- id: upload_tft_new #NOT IN USE FOR NOW - id: upload_tft_new #NOT IN USE FOR NOW
@@ -440,7 +440,7 @@ script:
// Tells the Nextion the content length of the tft file and baud rate it will be sent at // Tells the Nextion the content length of the tft file and baud rate it will be sent at
// Once the Nextion accepts the command it will wait until the file is successfully uploaded // Once the Nextion accepts the command it will wait until the file is successfully uploaded
// If it fails for any reason a power cycle of the display will be needed // If it fails for any reason a power cycle of the display will be needed
sprintf(command, "whmi-wris %d,%d,1", content_length_, update_baud_rate_); sprintf(command, "whmi-wris %d,%" PRIu32 ",1", content_length_, update_baud_rate_);
// Clear serial receive buffer // Clear serial receive buffer
uint8_t d; uint8_t d;
@@ -483,7 +483,7 @@ script:
if (transfer_buffer_ == nullptr) { if (transfer_buffer_ == nullptr) {
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE); ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
ESP_LOGD(TAG, "Allocating buffer size %d, Heap size is %u", chunk_size, ESP.getFreeHeap()); ESP_LOGD(TAG, "Allocating buffer size %d, Heap size is %" PRIu32, chunk_size, ESP.getFreeHeap());
transfer_buffer_ = allocator.allocate(chunk_size); transfer_buffer_ = allocator.allocate(chunk_size);
if (transfer_buffer_ == nullptr) { // Try a smaller size if (transfer_buffer_ == nullptr) { // Try a smaller size
ESP_LOGD(TAG, "Could not allocate buffer size: %d trying 4096 instead", chunk_size); ESP_LOGD(TAG, "Could not allocate buffer size: %d trying 4096 instead", chunk_size);
@@ -500,7 +500,7 @@ script:
transfer_buffer_size_ = chunk_size; transfer_buffer_size_ = chunk_size;
} }
ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d using %zu chunksize, Heap Size %d", ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d using %zu chunksize, Heap Size %" PRIu32,
url.c_str(), content_length_, transfer_buffer_size_, ESP.getFreeHeap()); url.c_str(), content_length_, transfer_buffer_size_, ESP.getFreeHeap());
int result = 0; int result = 0;
@@ -511,7 +511,7 @@ script:
return upload_end_(false); return upload_end_(false);
} }
App.feed_wdt(); App.feed_wdt();
ESP_LOGD(TAG, "Heap Size %d, Bytes left %d", ESP.getFreeHeap(), content_length_); ESP_LOGD(TAG, "Heap Size %" PRIu32 ", Bytes left %d", ESP.getFreeHeap(), content_length_);
} }
is_updating_ = false; is_updating_ = false;
ESP_LOGD(TAG, "Successfully updated Nextion!"); ESP_LOGD(TAG, "Successfully updated Nextion!");
@@ -597,7 +597,7 @@ script:
result += static_cast<uint8_t>(recv_string[j + 1]) << (8 * j); result += static_cast<uint8_t>(recv_string[j + 1]) << (8 * j);
} }
if (result > 0) { if (result > 0) {
ESP_LOGI(TAG, "Nextion reported new range %d", result); ESP_LOGI(TAG, "Nextion reported new range %" PRIu32, result);
content_length_ = tft_size_ - result; content_length_ = tft_size_ - result;
// Deallocate the buffer when done // Deallocate the buffer when done
delete[] buffer; delete[] buffer;
@@ -733,7 +733,7 @@ script:
return upload_end_(false); return upload_end_(false);
} }
ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d, Heap Size %d", ESP_LOGD(TAG, "Updating tft from \"%s\" with a file size of %d, Heap Size %" PRIu32,
url.c_str(), content_length_, esp_get_free_heap_size()); url.c_str(), content_length_, esp_get_free_heap_size());
ESP_LOGV(TAG, "Starting transfer by chunks loop"); ESP_LOGV(TAG, "Starting transfer by chunks loop");
@@ -746,7 +746,7 @@ script:
return upload_end_(false); return upload_end_(false);
} }
App.feed_wdt(); App.feed_wdt();
ESP_LOGV(TAG, "Heap Size %d, Bytes left %d", esp_get_free_heap_size(), content_length_); ESP_LOGV(TAG, "Heap Size %" PRIu32 ", Bytes left %d", esp_get_free_heap_size(), content_length_);
} }
is_updating_ = false; is_updating_ = false;