|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  eel.expose(renderUI);
 | 
	
		
			
				|  |  |  eel.expose(error)
 | 
	
		
			
				|  |  |  eel.expose(warning)
 | 
	
		
			
				|  |  | +eel.expose(message)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // Helper functions
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -97,6 +98,36 @@ function onload(){ //Bind events
 | 
	
		
			
				|  |  |  	document.getElementById("longGraphY").addEventListener("change", function(){
 | 
	
		
			
				|  |  |  		loadLongGraph()
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  | +	document.querySelector('#waveformGraphClear').addEventListener("click", function(event){
 | 
	
		
			
				|  |  | +		eel.clean_old_files("data/waveforms/", 0)
 | 
	
		
			
				|  |  | +	})
 | 
	
		
			
				|  |  | +	document.querySelector('#longGraphClear').addEventListener("click", function(event){
 | 
	
		
			
				|  |  | +		eel.clean_long_term()
 | 
	
		
			
				|  |  | +	})
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// Information for simple usage
 | 
	
		
			
				|  |  | +	tippy('#boxAdress', {delay: 3000, content: "The i2c adress used for communication with the board. This is automatically obtained.",})
 | 
	
		
			
				|  |  | +	tippy('#outOfLock', {delay: 3000, content: "The box is out of lock when the output of the board is maximum, and thus fluctuations cannot be stabilized anymore.",})
 | 
	
		
			
				|  |  | +	tippy('#piFreq', {delay: 3000, content: "Frequency at which the Pi polls the board for new waveforms, typically no more than 10Hz as this can disturb the board.",})
 | 
	
		
			
				|  |  | +	tippy('#boardFreq', {delay: 3000, content: "Frequency at which the board is currently measuring waveforms (untested).",})
 | 
	
		
			
				|  |  | +	tippy('#remoteTrigg', {delay: 3000, content: "If true, the board will continously trigger, ignoring the trigger input. For normal operation set to false.",})
 | 
	
		
			
				|  |  | +	tippy('#enabGnd', {delay: 3000, content: "If true (recommended), the board stabilizes signal-gnd, otherwise it stabilizes signal",})
 | 
	
		
			
				|  |  | +	tippy('#Vlearn', {delay: 3000, content: "The output voltage (0-4095) when the box is in learn mode. This can be used to select an appropiate input power. Small values will unnecessarily suppress the signal and large values (>3500, see response function) may result in out_of_lock due to the limited range.",})
 | 
	
		
			
				|  |  | +	tippy('#start', {delay: 3000, content: "Point # where the signal starts being measured. Sampling frequency ~1MHz.",})
 | 
	
		
			
				|  |  | +	tippy('#stop', {delay: 3000, content: "Point # where the signal stop being measured. Sampling frequency ~1MHz.",})
 | 
	
		
			
				|  |  | +	tippy('#startGnd', {delay: 3000, content: "Point # where the ground starts being measured. Sampling frequency ~1MHz.",})
 | 
	
		
			
				|  |  | +	tippy('#stopGnd', {delay: 3000, content: "Point # where the ground stops being measured. Sampling frequency ~1MHz.",})
 | 
	
		
			
				|  |  | +	tippy('#N', {delay: 3000, content: "Number of waveforms (typ. 1) to sample in each stabilization cycle.",})
 | 
	
		
			
				|  |  | +	tippy('#wfLen', {delay: 3000, content: "Number of points to sample (1-255)",})
 | 
	
		
			
				|  |  | +	tippy('#stepMax', {delay: 3000, content: "Maximum step allowed in one stabilization cycle (typ. 200) . Small values may lead to slow response to sharp fluctuations.",})
 | 
	
		
			
				|  |  | +	tippy('#Gain', {delay: 3000, content: "At every step Vout += (Vmeasured-Vset)*Gain",})
 | 
	
		
			
				|  |  | +	tippy('#calibrateGain', {delay: 3000, content: "Automatically select a loop gain based on the response function of the system.",})
 | 
	
		
			
				|  |  | +	tippy('#autoSetPga', {delay: 3000, content: "When True, the board changes the input gain and offset so that the signal is in an appropiate range (not clipped and going >2000). Set to False to select it manually.",})
 | 
	
		
			
				|  |  | +	tippy('#inputGain', {delay: 3000, content: "Allowed values: [1, 2, 4, 8, 16, 32, 64, 128]",})
 | 
	
		
			
				|  |  | +	tippy('#offset', {delay: 3000, content: "Input offset (0-4096). 2000 corresponds to no offset.",})
 | 
	
		
			
				|  |  | +	tippy('#coarseFineRatio', {delay: 3000, content: "Ratio of the precision in the fine and broad outputs. Typ. 20 from circuit design.",})
 | 
	
		
			
				|  |  | +	tippy('#calibrateCoarseFineRatio', {delay: 3000, content: "Calibrate the ratio by measuring the response functions of the broad and fine outputs.",})
 | 
	
		
			
				|  |  | +	tippy('#measureResponseFunction', {delay: 3000, content: "Measure the photodiode signal as a funtion of the output voltage.",})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	setTimeout(loop, 100)
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -340,4 +371,14 @@ function warning(txt){
 | 
	
		
			
				|  |  |  	  close: true,
 | 
	
		
			
				|  |  |  	  backgroundColor: "#e36d25",
 | 
	
		
			
				|  |  |  	  duration: 3000,}).showToast()
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function message(txt){
 | 
	
		
			
				|  |  | +	Toastify({
 | 
	
		
			
				|  |  | +	  text: txt,
 | 
	
		
			
				|  |  | +	  gravity: 'bottom',
 | 
	
		
			
				|  |  | +	  position: 'left',
 | 
	
		
			
				|  |  | +	  close: true,
 | 
	
		
			
				|  |  | +	  backgroundColor: "white",
 | 
	
		
			
				|  |  | +	  duration: 3000,}).showToast()
 | 
	
		
			
				|  |  |  }
 |