Baby Jesus is crying and Ada Babbage is rolling in her grave, no doubt.stinkbutt wrote:...or we're all independently determining that codeblock makes the Baby Jesus cry. But I digress...."Code: Select all
if (brightness <= 30) { OCR0A = 30; } else if (brightness <= 35) { OCR0A = 35; } else if (brightness <= 40) { OCR0A = 40; } else if (brightness <= 45) { OCR0A = 45;
That said, and not knowing AVR assembler, is it possible that code is smaller/faster than
Code: Select all
if (brightness <= BRIGHTNESS_MIN) {
OCR0A = BRIGHTNESS_MIN;
} else if (brightness >= BRIGHTNESS_MAX) {
OCR0A = BRIGHTNESS_MAX;
} else {
brightness = BRIGHTNESS_INCREMENT
* ((brightness + BRIGHTNESS_INCREMENT - 1)
/ BRIGHTNESS_INCREMENT);
}