// This function starts a new log file in the DataFlash, and writes // the format of supported messages in the log uint16_t DataFlash_Class::StartNewLog(void) { uint16_t ret; ret = start_new_log(); if (ret == 0xFFFF) { // don't write out formats if we fail to open the log return ret; } _startup_messagewriter.reset(); return ret; }
// 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; }
// This function starts a new log file in the DataFlash, and writes // the format of supported messages in the log uint16_t DataFlash_Class::StartNewLog(void) { uint16_t ret; ret = start_new_log(); if (ret == 0xFFFF) { // don't write out formats 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); } return ret; }
internal bool32 initialize_sound(sound_array *sounds) { ALCdevice *device = g_audioDevice = alcOpenDevice(NULL); if (device) { g_audioContext = alcCreateContext(device, NULL); if (alcMakeContextCurrent(g_audioContext)) { if (!start_new_log(AL_LOG_FILE)) { fprintf(stderr, "Failed to create new log file: %s\n", AL_LOG_FILE); } alListenerfv(AL_POSITION, g_listenerPos); alListenerfv(AL_VELOCITY, g_listenerVel); alListenerfv(AL_ORIENTATION, g_listenerOri); if (al_print_if_error("Failed to initialize listener\n")) return false; alGenSources(sounds->size, sounds->sources); if (al_print_if_error("Failed to generate audio sources\n")) return false; } else { al_log(true, "OpenAL: failed to make audio context current\n"); return false; } } else { al_log(true, "Failed to open device\n"); // TODO: fix bug where alcOpenDevice occasionally fails return false; } return true; }