| 860 | } |
| 861 | |
| 862 | bool OLEDDisplay::setLogBuffer(uint16_t lines, uint16_t chars){ |
| 863 | if (logBuffer != NULL) free(logBuffer); |
| 864 | uint16_t size = lines * chars; |
| 865 | if (size > 0) { |
| 866 | this->logBufferLine = 0; // Lines printed |
| 867 | this->logBufferFilled = 0; // Nothing stored yet |
| 868 | this->logBufferMaxLines = lines; // Lines max printable |
| 869 | this->logBufferSize = size; // Total number of characters the buffer can hold |
| 870 | this->logBuffer = (char *) malloc(size * sizeof(uint8_t)); |
| 871 | if(!this->logBuffer) { |
| 872 | DEBUG_OLEDDISPLAY("[OLEDDISPLAY][setLogBuffer] Not enough memory to create log buffer\n"); |
| 873 | return false; |
| 874 | } |
| 875 | } |
| 876 | return true; |
| 877 | } |
| 878 | |
| 879 | size_t OLEDDisplay::write(uint8_t c) { |
| 880 | if (this->logBufferSize > 0) { |
nothing calls this directly
no outgoing calls
no test coverage detected