-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from futurexdesign/Preheat
Add ability to start/stop and configurable preheat when starting a cycle
- Loading branch information
Showing
25 changed files
with
421 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Files in this folder are the raw input graphics for the application. All of these ultimately | ||
need to be run through tcMenuDesigner, or otherwise converted to hex to be stored in PROGMEM | ||
- All graphics used by the application must consist of 1 color on a transparent background. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) 2023 Kevin Balthaser [email protected] | ||
*/ | ||
// | ||
|
||
#include "EncoderShim.h" | ||
|
||
EncoderShim::EncoderShim() { | ||
|
||
} | ||
|
||
void EncoderShim::initForEncoder() { | ||
|
||
switches.init(internalDigitalIo(), SWITCHES_NO_POLLING, true); | ||
|
||
switches.addSwitchListener(BUTTON, this, NO_REPEAT, false); | ||
setupRotaryEncoderWithInterrupt(ENC1, ENC2, this, HWACCEL_NONE, FULL_CYCLE); | ||
} | ||
|
||
void EncoderShim::encoderHasChanged(int newValue) { | ||
Serial.println("Encoder Turned"); | ||
Serial.println(newValue); | ||
|
||
// Which way did the encoder go... | ||
bool direction; | ||
if (newValue < encoderValue) { | ||
direction = false; | ||
} else { | ||
direction = true; | ||
} | ||
|
||
encoderValue = newValue; | ||
|
||
menuMgr.valueChanged(newValue); | ||
Serial.println("Check for encoderChangeFn"); | ||
if (encoderChangeFn != nullptr) { | ||
Serial.println("call encoderChangefn Callback"); | ||
encoderChangeFn(direction, false); | ||
} | ||
|
||
} | ||
|
||
void EncoderShim::onPressed(pinid_t pin, bool held) { | ||
Serial.println("button down"); | ||
if (encoderClickFn != nullptr) { | ||
encoderClickFn(false, held); | ||
} | ||
} | ||
|
||
void EncoderShim::onReleased(pinid_t pin, bool held) { | ||
Serial.println("button up"); | ||
// always send false, since we don't want the normal tcMenu long press reset behavior, and we are acting | ||
// on Pressed long press, not release. | ||
menuMgr.onMenuSelect(false); | ||
} | ||
|
||
void EncoderShim::registerChangeCallback(EncoderShimFn callback) { | ||
|
||
encoderChangeFn = callback; | ||
|
||
} | ||
|
||
void EncoderShim::registerClickCallback(EncoderShimFn callback) { | ||
|
||
encoderClickFn = callback; | ||
|
||
} | ||
|
||
/** | ||
* Reinitialize the encoder with a and b pins reversed. | ||
*/ | ||
void EncoderShim::invertEncoderDirection() { | ||
setupRotaryEncoderWithInterrupt(ENC2, ENC1, this, HWACCEL_NONE, FULL_CYCLE); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2023 Kevin Balthaser [email protected] | ||
* | ||
* Create a shim that will sit in between the tcMenu layer, and the firmware. This will allow us to monitor the rotary | ||
* encoder on every cycle to pick up on movement events, and fire any callback events. | ||
*/ | ||
// | ||
|
||
#include "picoPlatform.h" // Need the platform pin definitions | ||
#include <tcMenu.h> | ||
|
||
#ifndef KIWIBOARDFIRMWARE_ENCODERSHIM_H | ||
#define KIWIBOARDFIRMWARE_ENCODERSHIM_H | ||
|
||
|
||
/** The definition of a callback from EncoderShim object */ | ||
typedef void (*EncoderShimFn)(bool direction, bool longPress); | ||
|
||
class EncoderShim : EncoderListener, SwitchListener { | ||
|
||
public: | ||
EncoderShim(); | ||
|
||
/** | ||
* Initialize the encoder and button for pins defined in picoPlatform. This must be called | ||
* before setupMenu. | ||
*/ | ||
void initForEncoder(); | ||
|
||
/** | ||
* Register the function that should be called when the encoder value changes. | ||
*/ | ||
void registerChangeCallback(EncoderShimFn callback); | ||
|
||
/** | ||
* Register the function that should be called when the encoder button has been pressed. | ||
*/ | ||
void registerClickCallback(EncoderShimFn callback); | ||
|
||
/** | ||
* Swap the two encoder pins, this will invert the direction of the encoder in all modes. | ||
*/ | ||
void invertEncoderDirection(); | ||
|
||
private: | ||
void encoderHasChanged(int newValue) override; | ||
|
||
void onPressed(pinid_t pin, bool held) override; | ||
|
||
void onReleased(pinid_t pin, bool held) override; | ||
|
||
// Callback Functions for click and change | ||
EncoderShimFn encoderChangeFn = nullptr; | ||
EncoderShimFn encoderClickFn = nullptr; | ||
|
||
int encoderValue = 0;// last known encoder value | ||
|
||
}; | ||
|
||
|
||
#endif //KIWIBOARDFIRMWARE_ENCODERSHIM_H |
Oops, something went wrong.