Exemplo n.º 1
0
static int writeTrackChannels(SampleRecord *sampleRecord, size_t currentTicks, TrackConfig *config){
	int rate = SAMPLE_DISABLED;
	{
		size_t sr = config->lapCountCfg.sampleRate;
		if (sr != SAMPLE_DISABLED){
			if ((currentTicks % sr) == 0){
				rate = HIGHER_SAMPLE_RATE(sr, rate);
				sampleRecord->Track_LapCountSample.intValue = getLapCount();
			}
		}
	}
	{
		size_t sr = config->splitTimeCfg.sampleRate;
		if (sr != SAMPLE_DISABLED){
			if ((currentTicks % sr) == 0){
				rate = HIGHER_SAMPLE_RATE(sr, rate);
				sampleRecord->Track_SplitTimeSample.floatValue = getLastSectorTime(); // getLastSplitTime()->getLastSectorTime() ?-jrwiebe 
			}
		}
	}
	{
		size_t sr = config->lapTimeCfg.sampleRate;
		if (sr != SAMPLE_DISABLED){
			if ((currentTicks % sr) == 0){
				rate = HIGHER_SAMPLE_RATE(sr, rate);
				sampleRecord->Track_LapTimeSample.floatValue = getLastLapTime();
			}
		}
	}
	{
		size_t sr = config->distanceCfg.sampleRate;
		if (sr != SAMPLE_DISABLED){
			if ((currentTicks % sr) == 0){
				rate = HIGHER_SAMPLE_RATE(sr, rate);
				sampleRecord->Track_DistanceSample.floatValue = getGpsDistance() * 0.621371192; //convert to miles
			}
		}
	}
	{
		size_t sr = config->predTimeCfg.sampleRate;
		if (sr != SAMPLE_DISABLED){
			if ((currentTicks % sr) == 0){
				rate = HIGHER_SAMPLE_RATE(sr, rate);
				sampleRecord->Track_PredTimeSample.floatValue = get_predicted_time(getGPSSpeed());
			}
		}
	}
	return rate;
}
float getLastSectorTimeInMinutes()
{
    return tinyMillisToMinutes(getLastSectorTime());
}