Skip to content

Commit

Permalink
Merge branch 'dev' into TS101
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Jun 18, 2023
2 parents 0d86d7b + 4d7e4f4 commit 341c3f6
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 33 deletions.
1 change: 1 addition & 0 deletions source/Core/BSP/MHP30/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,4 @@
#endif

#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
3 changes: 0 additions & 3 deletions source/Core/BSP/MHP30/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "stm32f1xx_hal.h"
#include "string.h"

#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))


void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
FLASH_EraseInitTypeDef pEraseInit;
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
Expand Down
9 changes: 7 additions & 2 deletions source/Core/BSP/Miniware/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips

#define TIP_HAS_DIRECT_PWM 1
#define TIP_HAS_DIRECT_PWM 1
#define POW_DC 1
#define POW_PD 1
#define I2C_SOFT_BUS_2 1
Expand Down Expand Up @@ -255,5 +255,10 @@

#else
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))

#endif

#ifdef MODEL_TS101
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
#else
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))
#endif
6 changes: 1 addition & 5 deletions source/Core/BSP/Miniware/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
#include "stm32f1xx_hal.h"
#include "string.h"

#ifdef MODEL_TS101
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
#else
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))
#endif

void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
FLASH_EraseInitTypeDef pEraseInit;
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
Expand Down
1 change: 1 addition & 0 deletions source/Core/BSP/Pinecil/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,6 @@
#endif

#define FLASH_LOGOADDR (0x08000000 + (126 * 1024))
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))

#define HAS_POWER_DEBUG_MENU
2 changes: 1 addition & 1 deletion source/Core/BSP/Pinecil/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "gd32vf103_libopt.h"
#include "string.h"
#define FMC_PAGE_SIZE ((uint16_t)0x400U)
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))

void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {

/* unlock the flash program/erase controller */
Expand Down
2 changes: 2 additions & 0 deletions source/Core/BSP/Pinecilv2/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,5 @@
#endif

#define FLASH_LOGOADDR (0x23000000 + (1022 * 1024))
#define FLASH_PAGE_SIZE (1024)
#define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr
4 changes: 0 additions & 4 deletions source/Core/BSP/Pinecilv2/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
#include "hal_flash.h"
#include "string.h"

#define FLASH_PAGE_SIZE (1024)

#define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr

void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
BL_Err_Type err = flash_erase(SETTINGS_START_PAGE, FLASH_PAGE_SIZE);
err = flash_write(SETTINGS_START_PAGE, buffer, length);
Expand Down
1 change: 1 addition & 0 deletions source/Core/BSP/Sequre_S60/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,4 @@
#endif

#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))
2 changes: 0 additions & 2 deletions source/Core/BSP/Sequre_S60/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include "stm32f1xx_hal.h"
#include "string.h"

#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))

void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
FLASH_EraseInitTypeDef pEraseInit;
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
Expand Down
2 changes: 1 addition & 1 deletion source/Core/Drivers/OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ void OLED::transitionScrollDown() {
screenBuffer[15] = (pageStart + 1) % 8;
uint8_t scrollCommandByte = 0b01000000;
OLED_Setup_Array[8].val = scrollCommandByte;
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, scrollCommandByte);
refresh();
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, scrollCommandByte);
}

void OLED::setRotation(bool leftHanded) {
Expand Down
8 changes: 8 additions & 0 deletions source/Core/Inc/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ typedef enum {
FAST = 3, //
MAX_VALUE = 4 //
} settingOffSpeed_t;

typedef enum {
NO = 0, // Disabled
SOLDER = 1, // Gain default soldering temp (Soldering Mode)
SLEEP = 2, // Gain default sleeping temp (Idle/Standby Mode)
ZERO = 3, // Power on only (No heat Mode)
} autoStartMode_t;

// Settings wide operations
void saveSettings();
bool loadSettings();
Expand Down
6 changes: 5 additions & 1 deletion source/Core/Src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
};
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));

void saveSettings() { flash_save_buffer((uint8_t *)&systemSettings, sizeof(systemSettingsType)); }
void saveSettings() {
if (memcmp((void *)SETTINGS_START_PAGE, (void *)&systemSettings, sizeof(systemSettingsType))) {
flash_save_buffer((uint8_t *)&systemSettings, sizeof(systemSettingsType));
}
}

bool loadSettings() {
// We read the flash
Expand Down
8 changes: 4 additions & 4 deletions source/Core/Src/settingsGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,16 +496,16 @@ static void displayBoostTemp(void) {
static void displayAutomaticStartMode(void) {

switch (getSettingValue(SettingsOptions::AutoStartMode)) {
case 0:
case autoStartMode_t::NO:
OLED::print(translatedString(Tr->SettingStartNoneChar), FontStyle::LARGE);
break;
case 1:
case autoStartMode_t::SOLDER:
OLED::print(translatedString(Tr->SettingStartSolderingChar), FontStyle::LARGE);
break;
case 2:
case autoStartMode_t::SLEEP:
OLED::print(translatedString(Tr->SettingStartSleepChar), FontStyle::LARGE);
break;
case 3:
case autoStartMode_t::ZERO:
OLED::print(translatedString(Tr->SettingStartSleepOffChar), FontStyle::LARGE);
break;
default:
Expand Down
7 changes: 1 addition & 6 deletions source/Core/Threads/OperatingModes/Sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
currentTempTargetDegC = stayOff ? 0 : min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp));
}
// draw the lcd
uint16_t tipTemp;
if (getSettingValue(SettingsOptions::TemperatureInF))
tipTemp = TipThermoModel::getTipInF();
else {
tipTemp = TipThermoModel::getTipInC();
}
uint16_t tipTemp = getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC();

OLED::clearScreen();
OLED::setCursor(0, 0);
Expand Down
8 changes: 4 additions & 4 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -662,14 +662,14 @@ Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle: ..
@test -d $(OUTPUT_DIR)/Core/Gen/translation.files || mkdir -p $(OUTPUT_DIR)/Core/Gen/translation.files
@echo 'Generating translations for language $*'
@$(HOST_PYTHON) ../Translations/make_translation.py \
--macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation.$*.cpp \
--macros $(CURDIR)/Core/Gen/macros.txt \
-o $(CURDIR)/Core/Gen/Translation.$*.cpp \
--output-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
$*

Core/Gen/macros.txt: Makefile
@test -d Core/Gen || mkdir -p Core/Gen
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF Core/Gen/macros.tmp - > $(PWD)/Core/Gen/macros.txt
@test -d $(CURDIR)/Core/Gen || mkdir -p $(CURDIR)/Core/Gen
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF $(CURDIR)/Core/Gen/macros.tmp - > $(CURDIR)/Core/Gen/macros.txt


#
Expand Down

0 comments on commit 341c3f6

Please sign in to comment.