TS80 Support Stage 1 (#365)

* Estimated pinout into the ioc file

* Fix Atollic paths to be somewhat more portable

* Add make command

* Add rough calls to ADC2 [untested]

* Using dual ADC injected modes

* Start both ADCs

* Move some IRQ's to ram exec

* Stabilize PID a bit more

* Add in ideas for tip type selection

* Update peripheral setup to support TS80

* Add tiptype formula / settings struct

* Add function ids to the settings menu

* Rough tip selection

* Rough out new cal routine for simple tips

* Hardware test is fairly close for first pass

* Add Simple calibration case [UNTESTED]

This adds the calibration option that uses boiling water to the calibration menu.

This is untested, and may need gain adjustments before use.

* [Feat] Add some QC testing code

* Typo fix

* Add double button press handler for different rising times

* Add hook for jump to sleep mode

* QC for 9V Works!

* Rough out QC handler, trim out old menu help text thats useless

* QC 9V working... Static all the things (Low on ROM)!

* Static all I2C to save space

* Move QC negotiation into background task so it doesnt block the UI

* Input V display works, tune ADC

* QC 3 steps working

* Start tip R measurements

* Impliment tip resistance

* Fix up the accel position, link in auto QC stages

* Fix tip title

* Tip type settings, Static OLED

* Revert I2C callbacks

* Misc Cleanup

* Better Gain value, need to investiate offset

* Add model warning

* Add TS80 Boot Logo (#367)

* Add TS80 Boot Logo

* Refined

* Moved down by 1px

* Add in power selection 18/24W

* Clean up accelerometer, fix TS100 builds, Fix voltage div cal
This commit is contained in:
Ben V. Brown
2018-10-11 14:44:56 +11:00
committed by GitHub
parent a609d702f5
commit 7d0af3fc4c
34 changed files with 5857 additions and 4735 deletions

View File

@@ -26,79 +26,83 @@ extern "C" {
#define OLED_WIDTH 96
#define FRAMEBUFFER_START 17
class OLED {
public:
OLED(FRToSI2C* i2cHandle); // Initialize Driver and store I2C pointer
void initialize(); // Startup the I2C coms (brings screen out of reset etc)
static void initialize(); // Startup the I2C coms (brings screen out of reset etc)
// Draw the buffer out to the LCD using the DMA Channel
void refresh() {
i2c->Transmit( DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START + (OLED_WIDTH * 2));
static void refresh() {
FRToSI2C::Transmit( DEVICEADDR_OLED, screenBuffer,
FRAMEBUFFER_START + (OLED_WIDTH * 2));
//DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
//or we need to goto double buffering
}
void drawChar(char c, char preCursorCommand = '\0'); // Draw a character to a specific location
static void drawChar(char c, char preCursorCommand = '\0'); // Draw a character to a specific location
// Turn the screen on or not
void displayOnOff(bool on) {
static void displayOnOff(bool on) {
displayOnOffState = on;
screenBuffer[1] = on ? 0xAF : 0xAE;
}
void setRotation(bool leftHanded); // Set the rotation for the screen
}
static void setRotation(bool leftHanded); // Set the rotation for the screen
// Get the current rotation of the LCD
bool getRotation() const {
static bool getRotation() {
return inLeftHandedMode;
}
void print(const char* string); // Draw a string to the current location, with current font
}
static int16_t getCursorX() {
return cursor_x;
}
static void print(const char* string);// Draw a string to the current location, with current font
// Set the cursor location by pixels
void setCursor(int16_t x, int16_t y) {
static void setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}
cursor_y = y;
}
//Set cursor location by chars in current font
void setCharCursor(int16_t x, int16_t y) {
static void setCharCursor(int16_t x, int16_t y) {
cursor_x = x * fontWidth;
cursor_y = y * fontHeight;
}
void setFont(uint8_t fontNumber); // (Future) Set the font that is being used
void drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
static void setFont(uint8_t fontNumber); // (Future) Set the font that is being used
static void drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
drawArea(x, 0, width, 16, buffer);
}
// Draws an image to the buffer, at x offset from top to bottom (fixed height renders)
void printNumber(uint16_t number, uint8_t places);
static void printNumber(uint16_t number, uint8_t places);
// Draws a number at the current cursor location
// Clears the buffer
void clearScreen() {
static void clearScreen() {
memset(&screenBuffer[FRAMEBUFFER_START], 0, OLED_WIDTH * 2);
}
}
// Draws the battery level symbol
void drawBattery(uint8_t state) {
static void drawBattery(uint8_t state) {
drawSymbol(3 + (state > 10 ? 10 : state));
}
}
// Draws a checkbox
void drawCheckbox(bool state) {
static void drawCheckbox(bool state) {
drawSymbol((state) ? 16 : 17);
}
void drawSymbol(uint8_t symbolID);//Used for drawing symbols of a predictable width
void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t* ptr); //Draw an area, but y must be aligned on 0/8 offset
void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t value); //Fill an area, but y must be aligned on 0/8 offset
void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,bool clear);
void drawHeatSymbol(uint8_t state);
static void drawSymbol(uint8_t symbolID);//Used for drawing symbols of a predictable width
static void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
const uint8_t* ptr); //Draw an area, but y must be aligned on 0/8 offset
static void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
const uint8_t value); //Fill an area, but y must be aligned on 0/8 offset
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
bool clear);
static void drawHeatSymbol(uint8_t state);
private:
//Draw a buffer to the screen buffer
FRToSI2C* i2c; //i2c Pointer
const uint8_t* currentFont; // Pointer to the current font used for rendering to the buffer
uint8_t* firstStripPtr; // Pointers to the strips to allow for buffer having extra content
uint8_t* secondStripPtr; //Pointers to the strips
bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
bool displayOnOffState; // If the display is on or not
uint8_t fontWidth, fontHeight;
int16_t cursor_x, cursor_y;
uint8_t displayOffset;
uint8_t screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer
static uint8_t* firstStripPtr; // Pointers to the strips to allow for buffer having extra content
static uint8_t* secondStripPtr; //Pointers to the strips
static bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
static bool displayOnOffState; // If the display is on or not
static uint8_t fontWidth, fontHeight;
static int16_t cursor_x, cursor_y;
static uint8_t displayOffset;
static uint8_t screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
};
#endif /* OLED_HPP_ */