Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VFD rework #1324

Merged
merged 7 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions FluidNC/src/Configuration/GenericFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Configuration {

GenericFactory() = default;

GenericFactory(const GenericFactory&) = delete;
GenericFactory(const GenericFactory&) = delete;
GenericFactory& operator=(const GenericFactory&) = delete;

class BuilderBase {
Expand All @@ -28,7 +28,7 @@ namespace Configuration {
public:
BuilderBase(const char* name) : name_(name) {}

BuilderBase(const BuilderBase& o) = delete;
BuilderBase(const BuilderBase& o) = delete;
BuilderBase& operator=(const BuilderBase& o) = delete;

virtual BaseType* create(const char* name) const = 0;
Expand Down Expand Up @@ -62,6 +62,24 @@ namespace Configuration {
BaseType* create(const char* name) const override { return new DerivedType(name); }
};

template <typename DerivedType, typename DependencyType>
class DependentInstanceBuilder : public BuilderBase {
public:
explicit DependentInstanceBuilder(const char* name, bool autocreate = false) : BuilderBase(name) {
instance().registerBuilder(this);
if (autocreate) {
auto& objects = instance().objects_;
auto object = create(name);
objects.push_back(object);
}
}

DerivedType* create(const char* name) const override {
auto dependency = new DependencyType();
return new DerivedType(name, dependency);
}
};

// This factory() method is used when there can be only one instance of the type,
// as with a kinematics system. The variable that points to the instance must
// be created externally and passed as an argument.
Expand All @@ -78,6 +96,7 @@ namespace Configuration {
handler.enterSection(inst->name(), inst);
}
}

// This factory() method is used when there can be multiple instances,
// as with spindles and modules. A vector in the GenericFactory<BaseType>
// singleton holds the derived type instances, so there is no need to
Expand Down
1 change: 1 addition & 0 deletions FluidNC/src/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
#else

# define WEAK_LINK
# define IRAM_ATTR

#endif
157 changes: 0 additions & 157 deletions FluidNC/src/Spindles/DanfossSpindle.cpp

This file was deleted.

83 changes: 0 additions & 83 deletions FluidNC/src/Spindles/DanfossSpindle.h

This file was deleted.

Loading
Loading