Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Core/Inc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#define ENABLE_DBG_SAVE
#define SWSTRING "SW: 1.13.14 " // Software version reported in settings screen
#define SYSTEM_SETTINGS_VERSION 29 // Change this if you change the system settings struct to prevent getting out of sync
#define SYSTEM_SETTINGS_VERSION 30 // Change this if you change the system settings struct to prevent getting out of sync
#define PROFILE_SETTINGS_VERSION 4 // Same, but for profile settings struct
#define TIP_SETTINGS_VERSION 1 // Same, but for tip settings struct
#define ADDONS_SETTINGS_VERSION 1 // Same, but for addons settings struct
Expand Down Expand Up @@ -264,6 +264,7 @@ __attribute__((aligned(4))) typedef struct{
uint8_t tempBigStep;
uint8_t guiTempDenoise;
uint8_t buzzerMode;
uint16_t beepDuration;
uint8_t buttonWakeMode;
uint8_t shakeWakeMode;
uint8_t lvp;
Expand Down
22 changes: 11 additions & 11 deletions Core/Src/iron.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ void ironInit(TIM_HandleTypeDef *delaytimer, TIM_HandleTypeDef *pwmtimer, uint32
Iron.Error.Flags = FLAG_NOERROR;

if(getProfileSettings()->WakeInputMode == mode_shake){
setCurrentMode(getSystemSettings()->initMode, MLONG_BEEP);
setCurrentMode(getSystemSettings()->initMode, BEEP_DURATION);
}
else{
if(WAKE_input()){
setCurrentMode(mode_run, MLONG_BEEP);
setCurrentMode(mode_run, BEEP_DURATION);
}
else{
setCurrentMode(getProfileSettings()->StandMode, MLONG_BEEP);
setCurrentMode(getProfileSettings()->StandMode, BEEP_DURATION);
}
}
initTimers();
Expand Down Expand Up @@ -156,13 +156,13 @@ void handleIron(void) {

if (!Iron.standMode_beepDone && (elapsed > 500) ){ // Apply a small delay of 500ms for the beep
Iron.standMode_beepDone = 1;
buzzer_beep(MLONG_BEEP);
buzzer_beep(BEEP_DURATION);
}
if(elapsed > delay){
Iron.standMode_beepDone = 0;
Iron.standMode_update = no_update;
Iron.lastWakeSrc = wakeSrc_Stand;
setCurrentMode(Iron.changeMode, MLONG_BEEP);
setCurrentMode(Iron.changeMode, BEEP_DURATION);
}
}
}
Expand Down Expand Up @@ -200,26 +200,26 @@ void handleIron(void) {

}
if((Iron.CurrentMode==mode_coldboost) && (mode_time>getProfileSettings()->coldBoostTimeout)){ // If cold boost mode and time expired
setCurrentMode(mode_run, MLONG_BEEP);
setCurrentMode(mode_run, BEEP_DURATION);
}
else if((Iron.CurrentMode==mode_boost) && (mode_time>getProfileSettings()->boostTimeout)){ // If boost mode and time expired
setCurrentMode(mode_run, MLONG_BEEP);
setCurrentMode(mode_run, BEEP_DURATION);
}
else if(Iron.CurrentMode==mode_run){ // If running
if(getProfileSettings()->standbyTimeout){ // If standby timer enabled
if(mode_time>getProfileSettings()->standbyTimeout){ // Check timeout
setCurrentMode(mode_standby, MLONG_BEEP);
setCurrentMode(mode_standby, BEEP_DURATION);
}
}
else{ // Otherwise, check sleep timeout
if(mode_time>getProfileSettings()->sleepTimeout){ //
setCurrentMode(mode_sleep, MLONG_BEEP);
setCurrentMode(mode_sleep, BEEP_DURATION);
}
}
}
else if(Iron.CurrentMode==mode_standby){ // If in standby
if(mode_time>getProfileSettings()->sleepTimeout){ // Check sleep timeout
setCurrentMode(mode_sleep, MLONG_BEEP);
setCurrentMode(mode_sleep, BEEP_DURATION);
}
}
}
Expand Down Expand Up @@ -640,7 +640,7 @@ bool IronWake(wakeSrc_t src){
}
}
if(Iron.CurrentMode<mode_boost)
setCurrentMode(mode_run, MLONG_BEEP);
setCurrentMode(mode_run, BEEP_DURATION);
Iron.lastWakeSrc = src;
return 1;
}
Expand Down
1 change: 1 addition & 0 deletions Core/Src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const systemSettings_t defaultSystemSettings = {
.lvp = 110, // 11.0V Low voltage
.initMode = mode_sleep, // Safer to boot in sleep mode by default!
.buzzerMode = disable,
.beepDuration = 500,
.buttonWakeMode = wake_all,
.shakeWakeMode = wake_all,
.EncoderMode = RE_Mode_Forward,
Expand Down
2 changes: 2 additions & 0 deletions Drivers/generalIO/buzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#define GENERALIO_BUZZER_H_

#include "main.h"
#include "settings.h"

#define SHORT_BEEP (uint16_t) 50
#define MEDIUM_BEEP (uint16_t) 200
#define MLONG_BEEP (uint16_t) 500
#define LONG_BEEP (uint16_t) 2000
#define BEEP_DURATION (getSystemSettings()->beepDuration)
#define ALARM_PERIOD (uint16_t) 2000
#define ALARM_HIGH (uint16_t) 10
#define ALARM_LOW (uint16_t) (ALARM_PERIOD-ALARM_HIGH)
Expand Down
9 changes: 9 additions & 0 deletions Drivers/graphics/gui/screens/gui_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Shake wake",
.SYSTEM_Encoder = "Encoder",
.SYSTEM_Buzzer = "Buzzer",
.SYSTEM_Beep_Duration = "Beep length",
.SYSTEM_Temperature = "Temperature",
.SYSTEM__Step = " Step",
.SYSTEM__Big_Step = " Big step",
Expand Down Expand Up @@ -271,6 +272,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Датчик раб.",
.SYSTEM_Encoder = "Вращение",
.SYSTEM_Buzzer = "Зуммер",
.SYSTEM_Beep_Duration = "Длит. сигн.",
.SYSTEM_Temperature = "Шкала темп.",
.SYSTEM__Step = " Шаг",
.SYSTEM__Big_Step = " Шаг быстр.",
Expand Down Expand Up @@ -452,6 +454,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Skakväck",
.SYSTEM_Encoder = "Encoder",
.SYSTEM_Buzzer = "Summer",
.SYSTEM_Beep_Duration = "Piplängd",
.SYSTEM_Temperature = "Temperatur",
.SYSTEM__Step = " Steg",
.SYSTEM__Big_Step = " Storsteg",
Expand Down Expand Up @@ -633,6 +636,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Bewegung",
.SYSTEM_Encoder = "Encoder",
.SYSTEM_Buzzer = "Buzzer",
.SYSTEM_Beep_Duration = "Signaldauer",
.SYSTEM_Temperature = "Temperatur",
.SYSTEM__Step = " Schritt",
.SYSTEM__Big_Step = " Sprung",
Expand Down Expand Up @@ -814,6 +818,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Salla Uyan",
.SYSTEM_Encoder = "Potans",
.SYSTEM_Buzzer = "Buzzer",
.SYSTEM_Beep_Duration = "Bip süresi",
.SYSTEM_Temperature = "Sıcaklık",
.SYSTEM__Step = " Adım",
.SYSTEM__Big_Step = " Byk Adım",
Expand Down Expand Up @@ -995,6 +1000,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Сбжд.двж.",
.SYSTEM_Encoder = "Въртене",
.SYSTEM_Buzzer = "Зумер",
.SYSTEM_Beep_Duration = "Дълж. сигнал",
.SYSTEM_Temperature = "Температура",
.SYSTEM__Step = " Стъпка1",
.SYSTEM__Big_Step = " Стъпка2",
Expand Down Expand Up @@ -1175,6 +1181,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "Pohyb",
.SYSTEM_Encoder = "Enkodér",
.SYSTEM_Buzzer = "Tón",
.SYSTEM_Beep_Duration = "Délka pípnutí",
.SYSTEM_Temperature = "Teplota",
.SYSTEM__Step = " Krok",
.SYSTEM__Big_Step = " Rychlý krok",
Expand Down Expand Up @@ -1357,6 +1364,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "振动唤醒",
.SYSTEM_Encoder = "编码器",
.SYSTEM_Buzzer = "蜂鸣器",
.SYSTEM_Beep_Duration = "蜂鸣时长",
.SYSTEM_Temperature = "溫度单位",
.SYSTEM__Step = "└单格步进",
.SYSTEM__Big_Step = "└快速步进",
Expand Down Expand Up @@ -1538,6 +1546,7 @@ const strings_t strings[LANGUAGE_COUNT] = {
.SYSTEM_Shake_Wake = "搖晃喚醒",
.SYSTEM_Encoder = "編碼器",
.SYSTEM_Buzzer = "蜂鳴器",
.SYSTEM_Beep_Duration = "蜂鳴時長",
.SYSTEM_Temperature = "溫度單位",
.SYSTEM__Step = "└單格步進",
.SYSTEM__Big_Step = "└快速步進",
Expand Down
1 change: 1 addition & 0 deletions Drivers/graphics/gui/screens/gui_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ typedef struct{
char * SYSTEM_Shake_Wake;
char * SYSTEM_Encoder;
char * SYSTEM_Buzzer;
char * SYSTEM_Beep_Duration;
char * SYSTEM_Temperature;
char * SYSTEM__Step;
char * SYSTEM__Big_Step;
Expand Down
21 changes: 21 additions & 0 deletions Drivers/graphics/gui/screens/system_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ static void setbuzzerMode(uint32_t *val) {
getSystemSettings()->buzzerMode = *val;
}
//=========================================================
static void * getBeepDuration() {
temp = getSystemSettings()->beepDuration;
return &temp;
}
static void setBeepDuration(uint32_t *val) {
getSystemSettings()->beepDuration = *val;
}
//=========================================================
static void * getInitMode() {
temp = getSystemSettings()->initMode;
return &temp;
Expand Down Expand Up @@ -280,6 +288,19 @@ static void system_create(screen_t *scr){
edit->options = strings[lang].OffOn;
edit->numberOfOptions = 2;

// [ Beep duration Widget ]
//
newComboEditable(w, strings[lang].SYSTEM_Beep_Duration, &edit, NULL);
dis=&edit->inputData;
dis->endString="ms";
dis->reservedChars=6;
dis->getData = &getBeepDuration;
edit->big_step = 200;
edit->step = 100;
edit->setData = (setterFn)&setBeepDuration;
edit->max_value = 1000;
edit->min_value = 100;

// [ Temp display unit Widget ]
//
newComboMultiOption(w, strings[lang].SYSTEM_Temperature, &edit, NULL);
Expand Down