I’ve finally got round to getting some TP4056 boards, and I plan to build one of Baldusi’s proper blade plug chargers. Which means I want to be certain that there’s no current draw during charging, in order to make sure the full charge detection works properly.
I plan to do away with the LED strips inside the charger and just use the two built-in status LEDs on the 4056 module to indicate charging or fully charged.
My question is really to Fredrik, Fett or NoSloppy, whose bladestyle knowledge I know is off the scale amazing - what blade style can I use that will switch the FETs on for charging, but won’t light the hilt-side blade connector LEDs? I know StylePtr Black will switch them off, as that’s what’s recommended to shutdown FET-powered Bluetooth modules. But I thought maybe a blinking style, blinking between Black and Black might con the Proffieboard into thinking the FETs need power, even though the data sent says to not light anything.
Or am I (as is so often the case) missing some glaringly simple and elegant solution to this?
1 Like
Add this to CONFIG_STYLES:
class BlackPower {
public:
LayerRunResult run(BladeBase* base) {
return LayerRunResult::UNKNOWN;
}
SimpleColor getColor(int led) {
return SimpleColor(Color16(0,0,0));
}
};
Then use StylePtr<BlackPower>()
to keep it on.
2 Likes
Amazing! Thanks Prof!
Forgive my ignorance, but do you mean to add it to the style_ptr.h file which is in the Styles folder? I’m guessing somewhere like line 122, so it looks like this:
BladeStyle* make() override {
DefaultArgumentParserWrapper dapw(CurrentArgParser, default_arguments_);
CurrentArgParser = &dapw;
BladeStyle* ret = allocator_->make();
CurrentArgParser = dapw.argParser_;
return ret;
}
StyleFactory* allocator_;
const char* default_arguments_;
};
// ***************************
class BlackPower {
public:
LayerRunResult run(BladeBase* base) {
return LayerRunResult::UNKNOWN;
}
SimpleColor getColor(int led) {
return SimpleColor(Color16(0,0,0));
}
};
// ***************************
template<class STYLE>
StyleAllocator StylePtr(const char* default_arguments) {
return new StyleFactoryWithDefault(StylePtr<STYLE>(), default_arguments);
}
// Same as StylePtr, but makes the style a "charging" style, which means
// that you can't turn it on/off, and the battery low warning is disabled.
template<class STYLE>
StyleAllocator ChargingStylePtr() {
static StyleFactoryImpl<ChargingStyle<STYLE> > factory;
return &factory;
}
#endif
Another hidden gem!
Thanks so much Prof. Now added to my config and compiles successfully. Will test in anger tomorrow once I’ve built the charge plug.