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

InputShaper.h « Movement « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9111715c600f7b544f8b46720cf180b436a2856c (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
42
43
44
45
46
47
48
49
50
51
52
/*
 * InputShaper.h
 *
 *  Created on: 20 Feb 2021
 *      Author: David
 */

#ifndef SRC_MOVEMENT_INPUTSHAPER_H_
#define SRC_MOVEMENT_INPUTSHAPER_H_

#include <RepRapFirmware.h>
#include <GCodes/GCodeResult.h>
#include <General/NamedEnum.h>
#include <ObjectModel/ObjectModel.h>

NamedEnum(InputShaperType, uint8_t,
	none,
	ZVD,
	ZVDD,
	EI2,
	DAA
);

class InputShaper INHERIT_OBJECT_MODEL
{
public:
	InputShaper() noexcept;

	uint16_t GetHalfPeriodClocks() const noexcept { return halfPeriod; }			// return the half period in step clocks
	float GetFullPeriod() const noexcept;											// return the full period in seconds
	float GetFrequency() const noexcept;
	float GetFloatDamping() const noexcept;
	float GetMinimumAcceleration() const noexcept { return minimumAcceleration; }
	InputShaperType GetType() const noexcept { return type; }

	GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException);	// process M593

protected:
	DECLARE_OBJECT_MODEL

private:
	static constexpr float DefaultFrequency = 40.0;
	static constexpr float DefaultDamping = 0.2;
	static constexpr float DefaultMinimumAcceleration = 10.0;

	uint16_t halfPeriod;							// half the period of ringing that we don't want to excite, in step clocks
	uint16_t damping;								// damping factor of the ringing as a 16-bit fractional number
	float minimumAcceleration;						// the minimum value that we reduce acceleration to
	InputShaperType type;
};

#endif /* SRC_MOVEMENT_INPUTSHAPER_H_ */