Merge branch 'dev' into epr-pinecil-og

This commit is contained in:
Ben V. Brown
2022-11-07 20:18:59 +11:00
committed by GitHub
41 changed files with 4904 additions and 4886 deletions

View File

@@ -25,7 +25,7 @@ bool OLED::initDone = false;
uint8_t OLED::displayOffset;
uint8_t OLED::screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
uint8_t OLED::secondFrameBuffer[OLED_WIDTH * 2];
uint32_t OLED::displayChecksum;
/*Setup params for the OLED screen*/
/*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/
/*All commands are prefixed with 0x80*/
@@ -222,7 +222,7 @@ void OLED::maskScrollIndicatorOnOLED() {
// it from the screen buffer which is updated by `OLED::setRotation`.
uint8_t rightmostColumn = screenBuffer[7];
uint8_t maskCommands[] = {
// Set column address:
// Set column address:
// A[6:0] - Column start address = rightmost column
// B[6:0] - Column end address = rightmost column
0x80,

View File

@@ -10,10 +10,12 @@
#ifndef OLED_HPP_
#define OLED_HPP_
#include "Font.h"
#include "cmsis_os.h"
#include "configuration.h"
#include <BSP.h>
#include <stdbool.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -47,16 +49,29 @@ public:
static void initialize(); // Startup the I2C coms (brings screen out of reset etc)
static bool isInitDone();
// Draw the buffer out to the LCD using the DMA Channel
// Draw the buffer out to the LCD if any content has changed.
static void refresh() {
I2C_CLASS::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
uint32_t hash = 0;
const int len = FRAMEBUFFER_START + (OLED_WIDTH * 2);
for (int i = 0; i < len; i++) {
hash += (i * screenBuffer[i]);
}
if (hash != displayChecksum) {
displayChecksum = hash;
I2C_CLASS::Transmit(DEVICEADDR_OLED, screenBuffer, len);
// DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
// or we need to goto double buffering
}
}
static void setDisplayState(DisplayState state) {
displayState = state;
screenBuffer[1] = (state == ON) ? 0xAF : 0xAE;
if (state != displayState) {
displayState = state;
screenBuffer[1] = (state == ON) ? 0xAF : 0xAE;
// Dump the screen state change out _now_
I2C_CLASS::Transmit(DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START - 1);
osDelay(TICKS_10MS);
}
}
static void setRotation(bool leftHanded); // Set the rotation for the screen
@@ -112,6 +127,7 @@ private:
static DisplayState displayState;
static int16_t cursor_x, cursor_y;
static uint8_t displayOffset;
static uint32_t displayChecksum;
static uint8_t screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
static uint8_t secondFrameBuffer[OLED_WIDTH * 2];
};

View File

@@ -36,39 +36,39 @@ extern const char *PowerSourceNames[];
enum class SettingsItemIndex : uint8_t {
DCInCutoff,
MinVolCell,
QCMaxVoltage,
PDNegTimeout,
BoostTemperature,
AutoStart,
TempChangeShortStep,
TempChangeLongStep,
LockingMode,
MotionSensitivity,
SleepTemperature,
SleepTimeout,
ShutdownTimeout,
MotionSensitivity,
TemperatureUnit,
AdvancedIdle,
DisplayRotation,
BoostTemperature,
AutoStart,
CooldownBlink,
CalibrateCJC,
SettingsReset,
VoltageCalibration,
AdvancedSoldering,
ScrollingSpeed,
QCMaxVoltage,
PDNegTimeout,
PowerLimit,
ReverseButtonTempChange,
TempChangeShortStep,
TempChangeLongStep,
PowerPulsePower,
HallEffSensitivity,
LockingMode,
MinVolCell,
AnimLoop,
TemperatureUnit,
DisplayRotation,
CooldownBlink,
ScrollingSpeed,
ReverseButtonTempChange,
AnimSpeed,
PowerPulseWait,
PowerPulseDuration,
LanguageSwitch,
AnimLoop,
Brightness,
ColourInversion,
LOGOTime,
AdvancedIdle,
AdvancedSoldering,
PowerLimit,
CalibrateCJC,
VoltageCalibration,
PowerPulsePower,
PowerPulseWait,
PowerPulseDuration,
SettingsReset,
LanguageSwitch,
NUM_ITEMS,
};

View File

@@ -17,7 +17,7 @@ HEXFILE_DIR=Hexfile
OUTPUT_DIR_BASE=Objects
OUTPUT_DIR=Objects/$(model)
ALL_LANGUAGES=BG CS DA DE EN ES FI FR HR HU IT JA_JP LT NL NL_BE NO PL PT RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW
ALL_LANGUAGES=BG CS DA DE EN ES FI FR HR HU IT JA_JP LT NL NL_BE NB PL PT RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW
LANGUAGE_GROUP_CJK_LANGS=EN JA_JP YUE_HK ZH_TW ZH_CN
LANGUAGE_GROUP_CJK_NAME=Chinese+Japanese
@@ -472,6 +472,30 @@ firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFIL
python3 dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
$(HEXFILE_DIR)/$(model)_%.elf : \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation.$*.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
$(HEXFILE_DIR)/$(model)_string_compressed_%.elf : \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.$*.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
$(HEXFILE_DIR)/$(model)_font_compressed_%.elf : \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
@@ -483,7 +507,6 @@ $(HEXFILE_DIR)/$(model)_%.elf : \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
@test -d $(@D) || mkdir -p $(@D)
@echo Compiling ${<}