|
tico 0.1
Mechanical Watch Terminal Timegrapher
|
#include "capture_helpers.h"#include "analysis.h"#include "modsigned.h"#include "mydefs.h"#include "myfft.h"#include "mymath.h"#include "mysync.h"#include "parseargs.h"#include "printing.h"#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>
Functions | |
| void | printFinals (CapConfig *cfg, AppResources *res, size_t totalTickTock) |
| Helper functions for capture.c, including printing, data shifting, logging, and fitting. More... | |
| void | fillReference (FILE *fpDefPeak, struct myarr *reference, size_t teeth) |
| Fills the reference array with data from the provided file pointer, based on the specified number of teeth. More... | |
| void | shiftBufferData (size_t *ticktock, struct myarr *subpos, struct myarr *maxpos, struct myarr *maxvals) |
| Shifts the buffer data for subpos, maxpos, and maxvals arrays by moving the data to the left and updating the ticktock value accordingly. More... | |
| void | processLogging (CapConfig *cfg, AppResources *res, size_t totalTime, size_t writeInterval) |
| Processes the logging of capture data, including printing the final results and handling any necessary logging based on the provided configuration and resources. More... | |
| void | fitAndPrint (const LoopState *state, struct myarr *cumulativeTick, AppResources *res, CapConfig *cfg, size_t currentColumns) |
| Fits a model to the capture data and prints the results, including calculating the intercept and slope, printing the header information, and visualizing the position of the maximum correlation based on the provided parameters. More... | |
| void | rotateDerivativeWindow (AppResources *res, int cumulativeShift) |
| Rotates the derivative window by shifting the data in the derivative array based on the cumulative shift and array length, effectively updating the window for the next iteration of processing. More... | |
| int | findMaxPosition (AppResources *res, struct myarr *cumulativeTick, const LoopState *state, CapConfig *cfg) |
| Finds the maximum position of the correlation in the capture data by performing an FFT fit and shifting the result based on the array length, using the provided resources and configuration settings. More... | |
| void | updateTotalShiftIfNeeded (LoopState *state, int peakOffset, AppResources *res, CapConfig *cfg) |
| Updates the total shift if needed based on the cumulative shift, peak offset, and other parameters, using the provided resources and configuration settings. More... | |
| void | printPeak (CapConfig *cfg, AppResources *res) |
| Prints the peak to the cfg->fpTotal file count, position data, and correlation data, based on the provided parameters. More... | |
| void fillReference | ( | FILE * | fpDefPeak, |
| struct myarr * | reference, | ||
| size_t | teeth | ||
| ) |
Fills the reference array with data from the provided file pointer, based on the specified number of teeth.
| fpDefPeak | The file pointer to read the reference data from. |
| reference | The myarr structure to store the reference data. |
| teeth | The number of teeth to determine how much data to read. |
| int findMaxPosition | ( | AppResources * | res, |
| struct myarr * | cumulativeTick, | ||
| const LoopState * | state, | ||
| CapConfig * | cfg | ||
| ) |
Finds the maximum position of the correlation in the capture data by performing an FFT fit and shifting the result based on the array length, using the provided resources and configuration settings.
| res | The resources used during the capture process, which may include data arrays and other relevant information for finding the maximum position. |
| cumulativeTick | The myarr structure containing cumulative tick data for beat error calculation, which may be used in the process of finding the maximum position. |
| state | The loop state structure for tracking cumulative shifts and tick indices |
| cfg | The configuration settings for the capture process, which may include parameters for fitting and finding the maximum position, such as the number of peaks to fit and the standard deviation threshold. |
| void fitAndPrint | ( | const LoopState * | state, |
| struct myarr * | cumulativeTick, | ||
| AppResources * | res, | ||
| CapConfig * | cfg, | ||
| size_t | currentColumns | ||
| ) |
Fits a model to the capture data and prints the results, including calculating the intercept and slope, printing the header information, and visualizing the position of the maximum correlation based on the provided parameters.
| state | The loop state structure for tracking cumulative shifts and tick indices |
| cumulativeTick | The myarr structure containing cumulative tick data for beat error calculation. |
| res | The resources used during the capture process, which may include data arrays and other relevant information for fitting and printing. |
| cfg | The configuration settings for the capture process, which may include parameters for fitting and printing. |
| currentColumns | The current number of columns available for printing, which may be used to determine how to visualize the output. |
| void printFinals | ( | CapConfig * | cfg, |
| AppResources * | res, | ||
| size_t | totalTickTock | ||
| ) |
Helper functions for capture.c, including printing, data shifting, logging, and fitting.
Prints the final results of the capture process, including total tick count, position data, and correlation data, based on the provided parameters.
| cfg | The configuration settings for the capture process. |
| res | The resources used during the capture process. |
| totalTickTock | The total tick count accumulated during the capture process. |
| void printPeak | ( | CapConfig * | cfg, |
| AppResources * | res | ||
| ) |
Prints the peak to the cfg->fpTotal file count, position data, and correlation data, based on the provided parameters.
| cfg | The configuration settings for the capture process. |
| res | The resources used during the capture process. process. |
| void processLogging | ( | CapConfig * | cfg, |
| AppResources * | res, | ||
| size_t | totalTime, | ||
| size_t | writeInterval | ||
| ) |
Processes the logging of capture data, including printing the final results and handling any necessary logging based on the provided configuration and resources.
| cfg | The configuration settings for the capture process, which may include file pointers for logging and other settings. |
| res | The resources used during the capture process, which may include data arrays and other relevant information. |
| totalTime | The total time elapsed during the capture process, which may be used for logging or final output. |
| writeInterval | The interval at which to write log data, which may be used to determine when to log certain information based on the total time. |
| void rotateDerivativeWindow | ( | AppResources * | res, |
| int | cumulativeShift | ||
| ) |
Rotates the derivative window by shifting the data in the derivative array based on the cumulative shift and array length, effectively updating the window for the next iteration of processing.
| res | The resources used during the capture process, which may include data arrays and other relevant information for rotating the derivative window. |
| cumulativeShift | The total shift that has been accumulated, which will be used to determine how much to rotate the derivative window. |
| void shiftBufferData | ( | size_t * | ticktock, |
| struct myarr * | subpos, | ||
| struct myarr * | maxpos, | ||
| struct myarr * | maxvals | ||
| ) |
Shifts the buffer data for subpos, maxpos, and maxvals arrays by moving the data to the left and updating the ticktock value accordingly.
| ticktock | A pointer to the current tick count that will be updated after shifting the data. |
| subpos | The myarr structure containing the subpos data to be shifted. |
| maxpos | The myarr structure containing the maxpos data to be shifted. |
| maxvals | The myarr structure containing the maxvals data to be shifted. |
| void updateTotalShiftIfNeeded | ( | LoopState * | state, |
| int | peakOffset, | ||
| AppResources * | res, | ||
| CapConfig * | cfg | ||
| ) |
Updates the total shift if needed based on the cumulative shift, peak offset, and other parameters, using the provided resources and configuration settings.
| state | The loop state structure for tracking cumulative shifts and tick indices on the peak |
| peakOffset | The offset of the peak position, which may be used to determine if an update to the total shift is needed based on the cumulative shift and other parameters. |
| res | The resources used during the capture process, which may include data arrays and other relevant information for updating the total shift if needed. |
| cfg | The configuration settings for the capture process, which may include parameters for fitting and updating the total shift, such as thresholds and other relevant settings. |