Skip to content

Commit cae2f62

Browse files
PetteriAimonenerichelgeson
authored andcommitted
initiator: Fix overflow in percentage calculation
When drive size was larger than 8 GB, LED indicator and logged percentage would reset to 0 midway through the transfer.
1 parent 39098a0 commit cae2f62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/BlueSCSI_initiator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void scsiInitiatorUpdateLed()
116116
// Update status indicator, the led blinks every 5 seconds and is on the longer the more data has been transferred
117117
const int period = 256;
118118
int phase = (millis() % period);
119-
int duty = g_initiator_state.sectors_done * period / g_initiator_state.sectorcount;
119+
int duty = (int64_t)g_initiator_state.sectors_done * period / g_initiator_state.sectorcount;
120120

121121
// Minimum and maximum time to verify that the blink is visible
122122
if (duty < 50) duty = 50;

0 commit comments

Comments
 (0)