Little pause ;) Using unions in EEPROM is not a very good idea for Linux / Windows interoperability

This commit is contained in:
bsongis
2012-07-01 15:02:00 +00:00
parent 4505d886f6
commit fcf93ad789
4 changed files with 8 additions and 11 deletions
+2 -2
View File
@@ -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:
+2 -2
View File
@@ -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);
}
}
+2 -5
View File
@@ -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
+2 -2
View File
@@ -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) {