1
0
forked from me/IronOS

Merge branch 'master' into refactor-adc

This commit is contained in:
Ben V. Brown
2021-09-12 19:18:58 +10:00
committed by GitHub
55 changed files with 6753 additions and 9590 deletions

View File

@@ -145,6 +145,14 @@ const uint8_t disconnectedTipIcon[] = {
//
};
// 16 x 16
const uint8_t brightnessIcon[]
= {0x80, 0x86, 0x8E, 0x9C, 0x18, 0xC0, 0xE0, 0xEF, 0xEF, 0xE0, 0xC0, 0x18, 0x9C, 0x8E, 0x86, 0x80, 0x01, 0x61, 0x71, 0x39, 0x18, 0x03, 0x07, 0xF7, 0xF7, 0x07, 0x03, 0x18, 0x39, 0x71, 0x61, 0x01};
// 24 x 16
const uint8_t invertDisplayIcon[] = {0xFE, 0x01, 0x79, 0x25, 0x79, 0x01, 0xFE, 0x00, 0x20, 0x20, 0x20, 0x20, 0xDF, 0x07, 0x8F, 0xDF, 0xFF, 0x01, 0xFE, 0x86, 0xDA, 0x86, 0xFE, 0x01,
0x7F, 0x80, 0xA4, 0xBE, 0xA0, 0x80, 0x7F, 0x00, 0x04, 0x0E, 0x1F, 0x04, 0xFB, 0xFB, 0xFB, 0xFB, 0xFF, 0x80, 0x7F, 0x5B, 0x41, 0x5F, 0x7F, 0x80};
/*
* 16x16 icons
* 32 * 3 = Frame size * Frame count

View File

@@ -45,8 +45,8 @@ I2C_CLASS::I2C_REG OLED_Setup_Array[] = {
{0x80, 0x14, 0}, /*Charge Pump settings*/
{0x80, 0xDA, 0}, /*Set VCOM Pins hardware config*/
{0x80, 0x02, 0}, /*Combination 2*/
{0x80, 0x81, 0}, /*Contrast*/
{0x80, 0x33, 0}, /*^51*/
{0x80, 0x81, 0}, /*Brightness*/
{0x80, 0x00, 0}, /*^0*/
{0x80, 0xD9, 0}, /*Set pre-charge period*/
{0x80, 0xF1, 0}, /*Pre charge period*/
{0x80, 0xDB, 0}, /*Adjust VCOMH regulator ouput*/
@@ -362,6 +362,17 @@ void OLED::setRotation(bool leftHanded) {
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
}
void OLED::setBrightness(uint8_t contrast) {
OLED_Setup_Array[15].val = contrast;
I2C_CLASS::writeRegistersBulk(DEVICEADDR_OLED, &OLED_Setup_Array[14], 2);
}
void OLED::setInverseDisplay(bool inverse) {
uint8_t normalInverseCmd = inverse ? 0xA7 : 0xA6;
OLED_Setup_Array[21].val = normalInverseCmd;
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, normalInverseCmd);
}
// print a string to the current cursor location
void OLED::print(const char *const str, FontStyle fontStyle) {
const uint8_t *next = reinterpret_cast<const uint8_t *>(str);

View File

@@ -62,6 +62,8 @@ public:
static void setRotation(bool leftHanded); // Set the rotation for the screen
// Get the current rotation of the LCD
static bool getRotation() { return inLeftHandedMode; }
static void setBrightness(uint8_t contrast);
static void setInverseDisplay(bool inverted);
static int16_t getCursorX() { return cursor_x; }
static void print(const char *string, FontStyle fontStyle); // Draw a string to the current location, with selected font
static void printWholeScreen(const char *string);

View File

@@ -41,10 +41,10 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool ski
// Now to divide this down by the gain
valueuV /= OP_AMP_GAIN_STAGE;
if (systemSettings.CalibrationOffset && skipCalOffset == false) {
if (getSettingValue(SettingsOptions::CalibrationOffset) && skipCalOffset == false) {
// Remove uV tipOffset
if (valueuV > systemSettings.CalibrationOffset)
valueuV -= systemSettings.CalibrationOffset;
if (valueuV > getSettingValue(SettingsOptions::CalibrationOffset))
valueuV -= getSettingValue(SettingsOptions::CalibrationOffset);
else
valueuV = 0;
}