mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-12 17:49:31 +00:00
fix warning and ub (#3089)
This commit is contained in:
@@ -294,8 +294,8 @@ bool BtnGridView::set_highlighted(int32_t new_value, bool force_update) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Normalize offset to show maximum items when count decreased
|
// Normalize offset to show maximum items when count decreased
|
||||||
if (offset + displayed_max > item_count && item_count > 0) {
|
if (item_count > 0 && offset + displayed_max > static_cast<size_t>(item_count)) {
|
||||||
if (item_count >= displayed_max) {
|
if (static_cast<size_t>(item_count) >= displayed_max) {
|
||||||
offset = item_count - displayed_max;
|
offset = item_count - displayed_max;
|
||||||
} else {
|
} else {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|||||||
@@ -342,7 +342,7 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
uint8_t fpga_register_read(uint8_t reg) {
|
uint8_t fpga_register_read(uint8_t reg) {
|
||||||
if (reg == 0 || reg > 5) return;
|
if (reg == 0 || reg > 5) return 0xFF;
|
||||||
|
|
||||||
ssp1_set_mode_ice40();
|
ssp1_set_mode_ice40();
|
||||||
uint8_t val = fpga_spi_read(reg);
|
uint8_t val = fpga_spi_read(reg);
|
||||||
|
|||||||
Reference in New Issue
Block a user