From fcf93ad789a8fd045f40178c97e6fa9a0f0dc112 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 1 Jul 2012 15:02:00 +0000 Subject: [PATCH] Little pause ;) Using unions in EEPROM is not a very good idea for Linux / Windows interoperability --- src/ersky9x/audio.cpp | 4 ++-- src/model_menus.cpp | 4 ++-- src/myeeprom.h | 7 ++----- src/open9x.cpp | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/ersky9x/audio.cpp b/src/ersky9x/audio.cpp index af5c55899..a8fd3a08a 100644 --- a/src/ersky9x/audio.cpp +++ b/src/ersky9x/audio.cpp @@ -359,7 +359,7 @@ void audioEvent(uint8_t e, uint8_t f) break; // error case AU_ERROR: - play(BEEP_DEFAULT_FREQ, 80, 2, PLAY_NOW); + play(BEEP_DEFAULT_FREQ, 50, 2, PLAY_NOW); break; // keypad up (seems to be used when going left/right through system menu options. 0-100 scales etc) case AU_KEYPAD_UP: @@ -391,7 +391,7 @@ void audioEvent(uint8_t e, uint8_t f) break; // warning three case AU_WARNING3: - play(BEEP_DEFAULT_FREQ, 60, 2, PLAY_NOW); + play(BEEP_DEFAULT_FREQ, 50, 2, PLAY_NOW); break; // startup tune case AU_TADA: diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 0da4b6c19..6ab09c7a5 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -2280,7 +2280,7 @@ void menuProcFunctionSwitches(uint8_t event) #endif #if defined(PCBARM) && defined(SDCARD) else if (sd->func == FUNC_PLAY_TRACK) { - lcd_putsnAtt(15*FW, y, sd->param.name, sizeof(sd->param.name), attr); + lcd_putsnAtt(15*FW, y, sd->param, sizeof(sd->param), attr); if (active && event==EVT_KEY_BREAK(KEY_MENU)) { s_editMode = 0; if (!listSdFiles(SOUNDS_PATH, SOUNDS_EXT)) { @@ -2363,7 +2363,7 @@ void menuProcFunctionSwitches(uint8_t event) } else { // The user choosed a wav file in the list - memcpy(g_model.funcSw[sub].param.name, result, sizeof(g_model.funcSw[sub].param.name)); + memcpy(g_model.funcSw[sub].param, result, sizeof(g_model.funcSw[sub].param)); eeDirty(EE_MODEL); } } diff --git a/src/myeeprom.h b/src/myeeprom.h index 9fcebe3ce..adf93ae9e 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -326,12 +326,9 @@ enum Functions { PACK(typedef struct t_FuncSwData { // Function Switches data int8_t swtch; //input uint8_t func; - union { - uint32_t value; - char name[6]; - } param; + char param[6]; }) FuncSwData; -#define FSW_PARAM(p) ((p)->param.value) +#define FSW_PARAM(p) (*((uint32_t*)(p)->param)) #else PACK(typedef struct t_FuncSwData { // Function Switches data int8_t swtch; //input diff --git a/src/open9x.cpp b/src/open9x.cpp index 1a08d8efe..b1c5f8551 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1689,13 +1689,13 @@ void evalFunctions() else if (sd->func == FUNC_PLAY_TRACK) { if (!audioBusy()) { char lfn[32] = SOUNDS_PATH "/"; - strcat(lfn, sd->param.name); + strcat(lfn, sd->param); strcat(lfn, SOUNDS_EXT); playFile(lfn); } } else if (sd->func == FUNC_VOLUME) { - requiredSpeakerVolume = ((1024 + getValue(sd->param.value)) * NUM_VOL_LEVELS) / 2048; + requiredSpeakerVolume = ((1024 + getValue(FSW_PARAM(sd))) * NUM_VOL_LEVELS) / 2048; } #elif defined(SOMO) else if (sd->func == FUNC_PLAY_TRACK || sd->func == FUNC_PLAY_VALUE) {