Skip to content

Allow Print::println() to work with PROGMEM strings #6450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cores/esp8266/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ size_t Print::write(const uint8_t *buffer, size_t size) {

size_t n = 0;
while (size--) {
size_t ret = write(*buffer++);
size_t ret = write(pgm_read_byte(buffer++));
if (ret == 0) {
// Write of last byte didn't complete, abort additional processing
break;
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/Print.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Print {
size_t write(const char *str) {
if(str == NULL)
return 0;
return write((const uint8_t *) str, strlen(str));
return write((const uint8_t *) str, strlen_P(str));
}
virtual size_t write(const uint8_t *buffer, size_t size);
size_t write(const char *buffer, size_t size) {
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ uart_write(uart_t* uart, const char* buf, size_t size)
size_t ret = size;
const int uart_nr = uart->uart_nr;
while (size--)
uart_do_write_char(uart_nr, *buf++);
uart_do_write_char(uart_nr, pgm_read_byte(buf++));

return ret;
}
Expand Down