Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ZProbe.cpp « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dcc6d4fb0020aa46f73ea34266d1fc6253044e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * ZProbe.cpp
 *
 *  Created on: 13 Feb 2018
 *      Author: David
 */

#include "ZProbe.h"

#include "Storage/FileStore.h"

// ZProbeParameters class
void ZProbe::Init(float h)
{
	adcValue = DefaultZProbeADValue;
	xOffset = yOffset = 0.0;
	triggerHeight = h;
	calibTemperature = 20.0;
	temperatureCoefficient = 0.0;	// no default temperature correction
	diveHeight = DefaultZDive;
	probeSpeed = DefaultProbingSpeed;
	travelSpeed = DefaultZProbeTravelSpeed;
	recoveryTime = 0.0;
	tolerance = DefaultZProbeTolerance;
	maxTaps = DefaultZProbeTaps;
	invertReading = turnHeatersOff = false;
}

float ZProbe::GetStopHeight(float temperature) const
{
	return ((temperature - calibTemperature) * temperatureCoefficient) + triggerHeight;
}

bool ZProbe::WriteParameters(FileStore *f, unsigned int probeType) const
{
	String<ScratchStringLength> scratchString;
	scratchString.printf("G31 T%u P%" PRIu32 " X%.1f Y%.1f Z%.2f\n", probeType, adcValue, (double)xOffset, (double)yOffset, (double)triggerHeight);
	return f->Write(scratchString.c_str());
}

// End