afiskon / stm32-ssd1306

STM32 library for working with OLEDs based on SSD1306, SH1106, SH1107 and SSD1309, supports I2C and SPI
https://eax.me/stm32-ssd1306/
MIT License
740 stars 206 forks source link

fix always true condition in angle normalization #78

Closed kossnikita closed 5 months ago

kossnikita commented 5 months ago
/* Normalize degree to [0;360] */
static uint16_t ssd1306_NormalizeTo0_360(uint16_t par_deg) {
    uint16_t loc_angle;
    if(par_deg <= 360) {
        loc_angle = par_deg;
    } else {
        loc_angle = par_deg % 360;
        loc_angle = ((par_deg != 0)?par_deg:360); // <- always true condition here
    }
    return loc_angle;
}

It should be loc_angle instead

afiskon commented 5 months ago

Thanks for the contribution. Merged.