示例#1
0
// This function starts a new log file in the DataFlash, and writes
// the format of supported messages in the log, plus all parameters
uint16_t DataFlash_Class::StartNewLog(uint8_t num_types, const struct LogStructure *structures)
{
    uint16_t ret;
    ret = start_new_log();

    // write log formats so the log is self-describing
    for (uint8_t i=0; i<num_types; i++) {
        Log_Write_Format(&structures[i]);
        // avoid corrupting the APM1/APM2 dataflash by writing too fast
        hal.scheduler->delay(10);
    }

    // and all current parameters
    Log_Write_Parameters();
    return ret;
}
示例#2
0
// This function starts a new log file in the DataFlash, and writes
// the format of supported messages in the log, plus all parameters
uint16_t DataFlash_Class::StartNewLog(void)
{
    uint16_t ret;
    ret = start_new_log();
    if (ret == 0xFFFF) {
        // don't write out parameters if we fail to open the log
        return ret;
    }
    // write log formats so the log is self-describing
    for (uint8_t i=0; i<_num_types; i++) {
        Log_Write_Format(&_structures[i]);
        // avoid corrupting the APM1/APM2 dataflash by writing too fast
        hal.scheduler->delay(10);
    }

    // and all current parameters
    Log_Write_Parameters();
    return ret;
}