better error message

This commit is contained in:
rusefi 2020-08-15 13:18:44 -04:00
parent cf1ab4ac03
commit bb3bed3890
1 changed files with 3 additions and 2 deletions

View File

@ -10,8 +10,9 @@ public class DfuConnectionUtil {
while (state.getState() == DfuCommandGetStatus.State.DFU_DOWNLOAD_BUSY || state.getState() == DfuCommandGetStatus.State.DFU_ERROR) {
state = DfuCommandGetStatus.read(logger, device);
logger.info("Loop state " + state);
if (System.currentTimeMillis() - enter > 10 * DfuConnection.SECOND)
throw new IllegalStateException("State does not look good");
long durationMs = System.currentTimeMillis() - enter;
if (durationMs > 10 * DfuConnection.SECOND)
throw new IllegalStateException("State does not look good after " + durationMs + "ms, still " + state);
}
}