| 232 | |
| 233 | // close any small gap to the right edge for visual completeness |
| 234 | if (prevX >= 0 && prevX < right) { |
| 235 | plotLineWidthBW(prevX, prevY, right, prevY, 1.5f, d); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | |
| 240 | logf("graph render: %dus\n", micros() - timeStamp); |
| 241 | } |
| 242 | |
| 243 | void App::StandardDisplay() |
| 244 | { |
| 245 | auto d = disp->d; |
| 246 | |
| 247 | if(shouldRedraw()){ |
| 248 | disp->StartRefresh(); |
| 249 | d->setRotation(2); |
| 250 | d->fillScreen(white); |
| 251 | |
| 252 | int readingCount = globalState->historyStart - globalState->historyEnd; |
| 253 | |
| 254 | d->drawBitmap(2, 0, bitmaps::thermometer32, 12, 32, black); |
| 255 | |
| 256 | // draw temperature value, degree symbol, and error |
| 257 | { |
| 258 | char tempstr[8]; |
| 259 | |
| 260 | if(globalState->currentSettings.tempFormat == TemperatureFormat::Celsius){ |
| 261 | |
| 262 | // separate integer and decimal digits with proper rounding |
| 263 | int iv; |
| 264 | int dv; |
| 265 | int t100 = globalState->lastClimateReading.temperature_raw; |
| 266 | { |
| 267 | int32_t t10 = (t100 >= 0) ? (t100 + 5) / 10 // +0.05 then truncate |
| 268 | : (t100 - 5) / 10; // -0.05 then truncate |
| 269 | |
| 270 | bool neg = (t10 < 0); |
| 271 | uint32_t at10 = neg ? static_cast<uint32_t>(-t10) |
| 272 | : static_cast<uint32_t>( t10); |
| 273 | iv = at10 / 10; |
| 274 | dv = at10 % 10; |
| 275 | } |
| 276 | sprintf(tempstr, "%d", iv); |
| 277 | d->setFont(&FreeMonoBold24pt7b); |
| 278 | disp->printf(18, 29, "%d", iv); |
| 279 | int16_t x1,y1; |
| 280 | uint16_t w,h; |
| 281 | d->getTextBounds(tempstr, 18, 28, &x1, &y1, &w, &h); |
| 282 | disp->print(x1 + w - 7, 29, "."); |
| 283 | disp->printf(x1 + w + 12, 29, "%d", dv); |
| 284 | d->drawBitmap(x1 + w + 40, 2, bitmaps::degree_symbol, 11, 11, black ); |
| 285 | } |
| 286 | else{ |
| 287 | // fahrenheit |
| 288 | int iv = (int)roundf(globalState->lastClimateReading.Temperature_f()); |
| 289 | sprintf(tempstr, "%d", iv); |
| 290 | d->setFont(&FreeMonoBold24pt7b); |
| 291 | disp->printf(18, 29, "%d", iv); |
nothing calls this directly
no test coverage detected