MCPcopy Create free account
hub / github.com/Michael-Manning/E-Paper-Climate-Logger / StandardDisplay

Method StandardDisplay

firmware/src/app.cpp:234–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
243void 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);

Callers

nothing calls this directly

Calls 12

GetTimeString12Function · 0.85
GetTimeString24Function · 0.85
logfFunction · 0.85
getBtn2DownFunction · 0.85
resetInactivityFunction · 0.85
StartRefreshMethod · 0.80
printfMethod · 0.80
printMethod · 0.80
Temperature_fMethod · 0.80
Temperature_cMethod · 0.80
Humidity_rMethod · 0.80
EndRefreshMethod · 0.80

Tested by

no test coverage detected