espaper-server-php
espaper-server-php copied to clipboard
Negative temperature issue
Hi, the math needs to be corrected to get valid lines on negative temperatures:
Something like this:
`
function tempToPixel($height, $max, $min, $temp) {
return ($temp - $min) * $height / ($max - $min);
}
for ($i = 0; $i < min(32, sizeof($temps)); $i++) { $height = tempToPixel(39, $max_temp, $min_temp, $temps[$i]); $canvas->fillRect(200 + $i * 3, 116 - $height, 2, $height); } `