I should really compile before pushing, fixed a scoping error on int result

This commit is contained in:
Jake Dahl
2018-10-09 10:20:57 -06:00
committed by Beat Küng
parent 1e1268f84b
commit ad567fa537
+6 -2
View File
@@ -117,18 +117,22 @@ int SMBus::block_write(const uint8_t cmd_code, void *data, uint8_t byte_count, b
}
unsigned i = 0;
int result = 0;
// If block_write fails, try up to 10 times.
while (i < 10) {
int result = transfer((uint8_t *)buf, byte_count + 2, nullptr, 0);
result = transfer((uint8_t *)buf, byte_count + 2, nullptr, 0);
if (result != PX4_OK) {
i++;
if (i == 10) {
PX4_WARN("Block_write failed 10 times");
result = -ENODATA;
result = -EINVAL;
}
} else {
break;
}
}