mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 09:58:28 -04:00
DataFlash_File: stop trying to stuff a uint64_t into a uint32_t
This commit is contained in:
parent
f712dd5d7e
commit
e11c276b35
@ -998,13 +998,13 @@ void DataFlash_File::ListAvailableLogs(AP_HAL::BetterStream *port)
|
|||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||||
void DataFlash_File::flush(void)
|
void DataFlash_File::flush(void)
|
||||||
{
|
{
|
||||||
uint32_t tnow = AP_HAL::micros();
|
uint32_t tnow = AP_HAL::millis();
|
||||||
hal.scheduler->suspend_timer_procs();
|
hal.scheduler->suspend_timer_procs();
|
||||||
while (_write_fd != -1 && _initialised && !_open_error && _writebuf.available()) {
|
while (_write_fd != -1 && _initialised && !_open_error && _writebuf.available()) {
|
||||||
// convince the IO timer that it really is OK to write out
|
// convince the IO timer that it really is OK to write out
|
||||||
// less than _writebuf_chunk bytes:
|
// less than _writebuf_chunk bytes:
|
||||||
if (tnow > 2000001) { // avoid resetting _last_write_time to 0
|
if (tnow > 2001) { // avoid resetting _last_write_time to 0
|
||||||
_last_write_time = tnow - 2000001;
|
_last_write_time = tnow - 2001;
|
||||||
}
|
}
|
||||||
_io_timer();
|
_io_timer();
|
||||||
}
|
}
|
||||||
@ -1025,9 +1025,9 @@ void DataFlash_File::_io_timer(void)
|
|||||||
if (nbytes == 0) {
|
if (nbytes == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t tnow = AP_HAL::micros();
|
uint32_t tnow = AP_HAL::millis();
|
||||||
if (nbytes < _writebuf_chunk &&
|
if (nbytes < _writebuf_chunk &&
|
||||||
tnow - _last_write_time < 2000000UL) {
|
tnow - _last_write_time < 2000UL) {
|
||||||
// write in _writebuf_chunk-sized chunks, but always write at
|
// write in _writebuf_chunk-sized chunks, but always write at
|
||||||
// least once per 2 seconds if data is available
|
// least once per 2 seconds if data is available
|
||||||
return;
|
return;
|
||||||
|
@ -146,8 +146,8 @@ private:
|
|||||||
// free-space checks; filling up SD cards under NuttX leads to
|
// free-space checks; filling up SD cards under NuttX leads to
|
||||||
// corrupt filesystems which cause loss of data, failure to gather
|
// corrupt filesystems which cause loss of data, failure to gather
|
||||||
// data and failures-to-boot.
|
// data and failures-to-boot.
|
||||||
uint64_t _free_space_last_check_time; // microseconds
|
uint32_t _free_space_last_check_time; // milliseconds
|
||||||
const uint32_t _free_space_check_interval = 1000000UL; // microseconds
|
const uint32_t _free_space_check_interval = 1000UL; // milliseconds
|
||||||
const uint32_t _free_space_min_avail = 8388608; // bytes
|
const uint32_t _free_space_min_avail = 8388608; // bytes
|
||||||
|
|
||||||
AP_HAL::Semaphore *semaphore;
|
AP_HAL::Semaphore *semaphore;
|
||||||
|
Loading…
Reference in New Issue
Block a user