<commit_before>#include<string.h> /* memset */
#include<stdlib.h>

#include "common.h"
#include "timehelpers.h"
#include "configurations.h"
#include "imageCreation.h"
#include "filterwheel.h"
#include "log.h"
#include "camera.h"
#include "spectrometer-shutter.h"
#include "spectrometer.h"
#include "spectroscopy.h"
#include "webcam.h"
#include "kbhit.h"
#include "io.h"

int aquire_darkframe(sParameterStruct * sParameters_A, sParameterStruct * sParameters_B, sWebCamStruct * webcam, sSpectrometerStruct * spectro, sConfigStruct * config);

static void callback(sParameterStruct * sSO2Parameters);

static void callback(sParameterStruct * sSO2Parameters)
{
	sSO2Parameters->fBufferReady = TRUE;

	/* Increment the Display Buffer Ready Count */
	sSO2Parameters->dBufferReadyCount++;
}

int startAquisition(sParameterStruct * sParameters_A,
	sParameterStruct * sParameters_B, sWebCamStruct * webcam, sSpectrometerStruct * spectro, sConfigStruct * config)
{
	int i = 0;
	log_message("Starting acquisition. Press a key to exit");

	for (i = 0; !kbhit() && (i < config->noofimages || config->noofimages == -1); i++) {
		if (i % config->darkframeintervall == 0){
			aquire_darkframe(sParameters_A, sParameters_B, webcam, spectro, config);
		}
		aquire(sParameters_A, sParameters_B, webcam, spectro, config);
	}

	return 0;
}

int aquire_darkframe(sParameterStruct * sParameters_A,
	sParameterStruct * sParameters_B, sWebCamStruct * webcam, sSpectrometerStruct * spectro, sConfigStruct * config)
{
	log_message("closing filterwheel");<commit_msg>recalc exposure time every 1000 images<commit_after>#include<string.h> /* memset */
#include<stdlib.h>

#include "common.h"
#include "timehelpers.h"
#include "configurations.h"
#include "imageCreation.h"
#include "filterwheel.h"
#include "log.h"
#include "camera.h"
#include "spectrometer-shutter.h"
#include "spectrometer.h"
#include "spectroscopy.h"
#include "webcam.h"
#include "kbhit.h"
#include "io.h"
#include "exposureTimeControl.h"

int aquire_darkframe(sParameterStruct * sParameters_A, sParameterStruct * sParameters_B, sWebCamStruct * webcam, sSpectrometerStruct * spectro, sConfigStruct * config);

static void callback(sParameterStruct * sSO2Parameters);

static void callback(sParameterStruct * sSO2Parameters)
{
	sSO2Parameters->fBufferReady = TRUE;

	/* Increment the Display Buffer Ready Count */
	sSO2Parameters->dBufferReadyCount++;
}

int startAquisition(sParameterStruct * sParameters_A,
	sParameterStruct * sParameters_B, sWebCamStruct * webcam, sSpectrometerStruct * spectro, sConfigStruct * config)
{
	int i = 0, state = 0;
	log_message("Starting acquisition. Press a key to exit");

	for (i = 0; !kbhit() && (i < config->noofimages || config->noofimages == -1); i++) {
		if (i % config->darkframeintervall == 0){
			aquire_darkframe(sParameters_A, sParameters_B, webcam, spectro, config);
		}
		if (i % 1000 == 0){
			/* set exposure */
			state = setExposureTime(sParameters_A, config);
			if (state != 0) {
				log_error("setExposureTime for cam B failed");
				return 1;
			}
			log_message("exposure time for cam A set");

			state = setExposureTime(sParameters_B, config);
			if (state != 0) {
				log_error("setExposureTime for cam B failed");
				return 1;
			}
			log_message("exposure time for cam B set");
		}
		aquire(sParameters_A, sParameters_B, webcam, spectro, config);
	}

	return 0;
}

int aquire_darkframe(sParameterStruct * sParameters_A,
	sParameterStruct * sParameters_B, sWebCamStruct * webcam, sSpectrometerStruct * spectro, sConfigStruct * config)
{
	log_message("closing filterwheel");
{'fraction_non_alphanumeric': 0.1233911583659765, 'fraction_numerical': 0.008953553441522105, 'mean_word_length': 5.657355679702048, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2928984', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1195, 'n_words': 284}