[sky9x] No shutdown after INVALID EEPROM
[all] Some functions names renamed
This commit is contained in:
+4
-5
@@ -540,17 +540,17 @@ void eeReadAll()
|
|||||||
if (!eeLoadGeneral() )
|
if (!eeLoadGeneral() )
|
||||||
{
|
{
|
||||||
generalDefault();
|
generalDefault();
|
||||||
|
modelDefault(0);
|
||||||
|
|
||||||
ALERT(STR_EEPROMWARN, STR_BADEEPROMDATA, AU_BAD_EEPROM);
|
ALERT(STR_EEPROMWARN, STR_BADEEPROMDATA, AU_BAD_EEPROM);
|
||||||
MESSAGE(STR_EEPROMWARN, STR_EEPROMFORMATTING, NULL, AU_EEPROM_FORMATTING);
|
|
||||||
|
|
||||||
modelDefault(0);
|
|
||||||
|
|
||||||
if (check_soft_power()==e_power_off) {
|
if (check_soft_power()==e_power_off) {
|
||||||
// we don't want to store anything
|
// we don't want to store anything
|
||||||
s_eeDirtyMsk = 0;
|
soft_power_off(); // turn power off now
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
MESSAGE(STR_EEPROMWARN, STR_EEPROMFORMATTING, NULL, AU_EEPROM_FORMATTING);
|
||||||
|
|
||||||
/* we remove all models */
|
/* we remove all models */
|
||||||
for (uint32_t i=0; i<MAX_MODELS; i++)
|
for (uint32_t i=0; i<MAX_MODELS; i++)
|
||||||
eeDeleteModel(i);
|
eeDeleteModel(i);
|
||||||
@@ -561,7 +561,6 @@ void eeReadAll()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eeLoadModel(g_eeGeneral.currModel);
|
|
||||||
ee32_read_model_names() ;
|
ee32_read_model_names() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#else
|
#else
|
||||||
#define WRITE_DELAY_10MS 200
|
#define WRITE_DELAY_10MS 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern uint8_t s_eeDirtyMsk;
|
||||||
extern uint16_t s_eeDirtyTime10ms;
|
extern uint16_t s_eeDirtyTime10ms;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -200,11 +200,11 @@ inline void lcd_square(xcoord_t x, uint8_t y, xcoord_t w, uint8_t att=0) { lcd_r
|
|||||||
|
|
||||||
extern void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, uint8_t mode);
|
extern void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, uint8_t mode);
|
||||||
extern void lcdSetRefVolt(unsigned char val);
|
extern void lcdSetRefVolt(unsigned char val);
|
||||||
extern void lcd_init();
|
extern void lcdInit();
|
||||||
extern void lcd_clear();
|
extern void lcd_clear();
|
||||||
extern void lcdSetContrast();
|
extern void lcdSetContrast();
|
||||||
|
|
||||||
extern void refreshDisplay();
|
extern void lcdRefresh();
|
||||||
|
|
||||||
#if defined(PCBX9D)
|
#if defined(PCBX9D)
|
||||||
const pm_char * bmpLoad(uint8_t *dest, const char *filename);
|
const pm_char * bmpLoad(uint8_t *dest, const char *filename);
|
||||||
|
|||||||
+1
-1
@@ -495,7 +495,7 @@ void menuMainView(uint8_t event)
|
|||||||
x0 = (i%4*9+3)*FW/2;
|
x0 = (i%4*9+3)*FW/2;
|
||||||
y0 = i/4*FH+40;
|
y0 = i/4*FH+40;
|
||||||
#if defined(PPM_UNIT_US)
|
#if defined(PPM_UNIT_US)
|
||||||
lcd_outdezAtt(x0+4*FW , y0, PPM_CENTER+calcRESXto1000(val)/5*64/25, 0);
|
lcd_outdezAtt(x0+4*FW , y0, PPM_CH_CENTER(chan)+val/2, 0);
|
||||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||||
lcd_outdezAtt(x0+4*FW , y0, calcRESXto1000(val), PREC1);
|
lcd_outdezAtt(x0+4*FW , y0, calcRESXto1000(val), PREC1);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+1
-1
@@ -637,7 +637,7 @@ void displayPopup(const pm_char * pstr)
|
|||||||
s_warning = pstr;
|
s_warning = pstr;
|
||||||
displayBox();
|
displayBox();
|
||||||
s_warning = 0;
|
s_warning = 0;
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayWarning(uint8_t event)
|
void displayWarning(uint8_t event)
|
||||||
|
|||||||
+1
-1
@@ -2312,7 +2312,7 @@ void menuModelLimits(uint8_t event)
|
|||||||
|
|
||||||
if (sub < NUM_CHNOUT) {
|
if (sub < NUM_CHNOUT) {
|
||||||
#if defined(PPM_CENTER_ADJUSTABLE)
|
#if defined(PPM_CENTER_ADJUSTABLE)
|
||||||
lcd_outdezAtt(13*FW, 0, PPM_CENTER+limitaddress(sub)->ppmCenter+g_chans512[sub]/2, 0);
|
lcd_outdezAtt(13*FW, 0, PPM_CH_CENTER(sub)+g_chans512[sub]/2, 0);
|
||||||
lcd_puts(13*FW, 0, STR_US);
|
lcd_puts(13*FW, 0, STR_US);
|
||||||
#else
|
#else
|
||||||
lcd_outdezAtt(13*FW, 0, calcRESXto1000(g_chans512[sub]), PREC1);
|
lcd_outdezAtt(13*FW, 0, calcRESXto1000(g_chans512[sub]), PREC1);
|
||||||
|
|||||||
+38
-22
@@ -182,24 +182,30 @@ uint8_t zlen(const char *str, uint8_t size)
|
|||||||
|
|
||||||
char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx)
|
char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx)
|
||||||
{
|
{
|
||||||
memcpy(dest, name, size);
|
// TODO review if all if are needed
|
||||||
dest[size] = '\0';
|
|
||||||
|
|
||||||
int8_t i = size-1;
|
|
||||||
int8_t len = 0;
|
int8_t len = 0;
|
||||||
while (i>=0) {
|
|
||||||
if (!len && dest[i])
|
if (name) {
|
||||||
len = i+1;
|
memcpy(dest, name, size);
|
||||||
if (len) {
|
dest[size] = '\0';
|
||||||
if (dest[i])
|
|
||||||
dest[i] = idx2char(dest[i]);
|
int8_t i = size-1;
|
||||||
else
|
|
||||||
dest[i] = '_';
|
while (i>=0) {
|
||||||
|
if (!len && dest[i])
|
||||||
|
len = i+1;
|
||||||
|
if (len) {
|
||||||
|
if (dest[i])
|
||||||
|
dest[i] = idx2char(dest[i]);
|
||||||
|
else
|
||||||
|
dest[i] = '_';
|
||||||
|
}
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0 && defaultName) {
|
||||||
strcpy(dest, defaultName);
|
strcpy(dest, defaultName);
|
||||||
dest[defaultNameSize] = (char)((defaultIdx / 10) + '0');
|
dest[defaultNameSize] = (char)((defaultIdx / 10) + '0');
|
||||||
dest[defaultNameSize + 1] = (char)((defaultIdx % 10) + '0');
|
dest[defaultNameSize + 1] = (char)((defaultIdx % 10) + '0');
|
||||||
@@ -1164,7 +1170,7 @@ void doSplash()
|
|||||||
if (SPLASH_NEEDED()) {
|
if (SPLASH_NEEDED()) {
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_img(0, 0, splash_lbm, 0, 0);
|
lcd_img(0, 0, splash_lbm, 0, 0);
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
|
|
||||||
#if !defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
AUDIO_TADA();
|
AUDIO_TADA();
|
||||||
@@ -1309,7 +1315,7 @@ void checkSwitches()
|
|||||||
if (i == 4 && attr) i++;
|
if (i == 4 && attr) i++;
|
||||||
if (i != 4) x += 3*FW+FW/2;
|
if (i != 4) x += 3*FW+FW/2;
|
||||||
}
|
}
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
last_bad_switches = switches_states;
|
last_bad_switches = switches_states;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,7 +1372,7 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
|
|||||||
lcd_putsLeft(7*FH, last);
|
lcd_putsLeft(7*FH, last);
|
||||||
AUDIO_ERROR_MESSAGE(sound);
|
AUDIO_ERROR_MESSAGE(sound);
|
||||||
}
|
}
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
lcdSetContrast();
|
lcdSetContrast();
|
||||||
clearKeyEvents();
|
clearKeyEvents();
|
||||||
}
|
}
|
||||||
@@ -2536,6 +2542,9 @@ FORCEINLINE void doMixerCalculations()
|
|||||||
int32_t weight = 0;
|
int32_t weight = 0;
|
||||||
|
|
||||||
if (s_last_phase != phase) {
|
if (s_last_phase != phase) {
|
||||||
|
// PLAY_PHASE_OFF(s_last_phase);
|
||||||
|
// PLAY_PHASE_ON(phase);
|
||||||
|
|
||||||
if (s_last_phase == 255) {
|
if (s_last_phase == 255) {
|
||||||
fp_act[phase] = MAX_ACT;
|
fp_act[phase] = MAX_ACT;
|
||||||
}
|
}
|
||||||
@@ -2894,7 +2903,7 @@ void perMain()
|
|||||||
g_menuStack[g_menuStackPtr](warn ? 0 : evt);
|
g_menuStack[g_menuStackPtr](warn ? 0 : evt);
|
||||||
if (warn) displayWarning(evt);
|
if (warn) displayWarning(evt);
|
||||||
drawStatusLine();
|
drawStatusLine();
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
|
|
||||||
if (SLAVE_MODE()) {
|
if (SLAVE_MODE()) {
|
||||||
JACK_PPM_OUT();
|
JACK_PPM_OUT();
|
||||||
@@ -3361,6 +3370,9 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
|||||||
|
|
||||||
if (UNEXPECTED_SHUTDOWN()) {
|
if (UNEXPECTED_SHUTDOWN()) {
|
||||||
unexpectedShutdown = 1;
|
unexpectedShutdown = 1;
|
||||||
|
#if defined(CPUARM)
|
||||||
|
eeLoadModel(g_eeGeneral.currModel);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doSplash();
|
doSplash();
|
||||||
@@ -3371,6 +3383,10 @@ inline void open9xInit(OPEN9X_INIT_ARGS)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CPUARM)
|
||||||
|
eeLoadModel(g_eeGeneral.currModel);
|
||||||
|
#endif
|
||||||
|
|
||||||
checkAll();
|
checkAll();
|
||||||
checkAlarm();
|
checkAlarm();
|
||||||
}
|
}
|
||||||
@@ -3468,7 +3484,7 @@ void menusTask(void * pdata)
|
|||||||
eeCheck(true);
|
eeCheck(true);
|
||||||
|
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
lcdSetRefVolt(0);
|
lcdSetRefVolt(0);
|
||||||
|
|
||||||
soft_power_off(); // Only turn power off if necessary
|
soft_power_off(); // Only turn power off if necessary
|
||||||
@@ -3497,7 +3513,7 @@ int main(void)
|
|||||||
|
|
||||||
board_init();
|
board_init();
|
||||||
|
|
||||||
lcd_init();
|
lcdInit();
|
||||||
|
|
||||||
stack_paint();
|
stack_paint();
|
||||||
|
|
||||||
@@ -3552,7 +3568,7 @@ int main(void)
|
|||||||
|
|
||||||
g_eeGeneral.optrexDisplay = 1;
|
g_eeGeneral.optrexDisplay = 1;
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
refreshDisplay();
|
lcdRefresh();
|
||||||
|
|
||||||
g_eeGeneral.optrexDisplay = 0;
|
g_eeGeneral.optrexDisplay = 0;
|
||||||
g_eeGeneral.backlightBright = 0;
|
g_eeGeneral.backlightBright = 0;
|
||||||
@@ -3564,7 +3580,7 @@ int main(void)
|
|||||||
lcd_putcAtt( 48, 24, 'U', DBLSIZE ) ;
|
lcd_putcAtt( 48, 24, 'U', DBLSIZE ) ;
|
||||||
lcd_putcAtt( 60, 24, 'S', DBLSIZE ) ;
|
lcd_putcAtt( 60, 24, 'S', DBLSIZE ) ;
|
||||||
lcd_putcAtt( 72, 24, 'B', DBLSIZE ) ;
|
lcd_putcAtt( 72, 24, 'B', DBLSIZE ) ;
|
||||||
refreshDisplay() ;
|
lcdRefresh() ;
|
||||||
|
|
||||||
usbBootloader();
|
usbBootloader();
|
||||||
}
|
}
|
||||||
@@ -3622,7 +3638,7 @@ int main(void)
|
|||||||
closeLogs();
|
closeLogs();
|
||||||
#endif
|
#endif
|
||||||
lcd_clear() ;
|
lcd_clear() ;
|
||||||
refreshDisplay() ;
|
lcdRefresh() ;
|
||||||
soft_power_off(); // Only turn power off if necessary
|
soft_power_off(); // Only turn power off if necessary
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
while(1); // never return from main() - there is no code to return back, if any delays occurs in physical power it does dead loop.
|
while(1); // never return from main() - there is no code to return back, if any delays occurs in physical power it does dead loop.
|
||||||
|
|||||||
+10
-4
@@ -206,6 +206,12 @@ extern void board_init();
|
|||||||
|
|
||||||
#define PPM_CENTER 1500
|
#define PPM_CENTER 1500
|
||||||
|
|
||||||
|
#if defined(PPM_CENTER_ADJUSTABLE)
|
||||||
|
#define PPM_CH_CENTER(ch) (PPM_CENTER+limitaddress(ch)->ppmCenter)
|
||||||
|
#else
|
||||||
|
#define PPM_CH_CENTER(ch) (PPM_CENTER)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#include "eeprom_arm.h"
|
#include "eeprom_arm.h"
|
||||||
#include "pulses_arm.h"
|
#include "pulses_arm.h"
|
||||||
@@ -909,8 +915,6 @@ void checkAll();
|
|||||||
void getADC();
|
void getADC();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t s_eeDirtyMsk;
|
|
||||||
|
|
||||||
#define STORE_MODELVARS eeDirty(EE_MODEL)
|
#define STORE_MODELVARS eeDirty(EE_MODEL)
|
||||||
#define STORE_GENERALVARS eeDirty(EE_GENERAL)
|
#define STORE_GENERALVARS eeDirty(EE_GENERAL)
|
||||||
|
|
||||||
@@ -1345,8 +1349,10 @@ void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t
|
|||||||
uint8_t zlen(const char *str, uint8_t size);
|
uint8_t zlen(const char *str, uint8_t size);
|
||||||
char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx);
|
char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx);
|
||||||
#define strcat_modelname(dest, idx) strcat_zchar(dest, ModelNames[idx], sizeof(g_model.name), STR_MODEL, PSIZE(TR_MODEL), idx+1)
|
#define strcat_modelname(dest, idx) strcat_zchar(dest, ModelNames[idx], sizeof(g_model.name), STR_MODEL, PSIZE(TR_MODEL), idx+1)
|
||||||
#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.phaseData[idx].name, sizeof(PhaseData), STR_FP, PSIZE(TR_FP), idx+1)
|
#define strcat_phasename_default(dest, idx) strcat_zchar(dest, NULL, 0, STR_FP, PSIZE(TR_FP), idx+1)
|
||||||
#define strcat_mixername(dest, idx) strcat_zchar(dest, g_model.mixData[idx].name, sizeof(MixData), STR_MIX, PSIZE(TR_MIX), idx+1)
|
#define strcat_phasename_nodefault(dest, idx) strcat_zchar(dest, g_model.phaseData[idx].name, sizeof(PhaseData), NULL, 0, 0)
|
||||||
|
#define strcat_mixername_default(dest, idx) strcat_zchar(dest, NULL, 0, STR_MIX, PSIZE(TR_MIX), idx+1)
|
||||||
|
#define strcat_mixername_nodefault(dest, idx) strcat_zchar(dest, g_model.mixData[idx].name, sizeof(MixData), NULL, 0, 0)
|
||||||
#define ZLEN(s) zlen(s, sizeof(s))
|
#define ZLEN(s) zlen(s, sizeof(s))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -585,7 +585,7 @@ void lcdSetRefVolt(uint8_t val)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshDisplay()
|
void lcdRefresh()
|
||||||
{
|
{
|
||||||
memcpy(lcd_buf, displayBuf, sizeof(displayBuf));
|
memcpy(lcd_buf, displayBuf, sizeof(displayBuf));
|
||||||
lcd_refresh = true;
|
lcd_refresh = true;
|
||||||
|
|||||||
+74
-19
@@ -95,9 +95,10 @@ void refreshSystemAudioFiles()
|
|||||||
sdAvailableSystemAudioFiles = availableAudioFiles;
|
sdAvailableSystemAudioFiles = availableAudioFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * suffixes[] = { "-OFF", "-ON", "-BG", NULL };
|
||||||
|
|
||||||
inline uint8_t getAvailableFiles(char *prefix, FILINFO &info, char *filename)
|
inline uint8_t getAvailableFiles(char *prefix, FILINFO &info, char *filename)
|
||||||
{
|
{
|
||||||
const char * suffixes[] = { "-ON", "-OFF", NULL };
|
|
||||||
uint8_t result = 0;
|
uint8_t result = 0;
|
||||||
|
|
||||||
for (uint8_t i=0; suffixes[i]; i++) {
|
for (uint8_t i=0; suffixes[i]; i++) {
|
||||||
@@ -113,8 +114,6 @@ inline uint8_t getAvailableFiles(char *prefix, FILINFO &info, char *filename)
|
|||||||
void refreshModelAudioFiles()
|
void refreshModelAudioFiles()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// TODO not finished!
|
|
||||||
|
|
||||||
FILINFO info;
|
FILINFO info;
|
||||||
#if _USE_LFN
|
#if _USE_LFN
|
||||||
TCHAR lfn[_MAX_LFN + 1];
|
TCHAR lfn[_MAX_LFN + 1];
|
||||||
@@ -122,38 +121,94 @@ void refreshModelAudioFiles()
|
|||||||
info.lfsize = sizeof(lfn);
|
info.lfsize = sizeof(lfn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char filename[32] = SOUNDS_PATH "/";
|
char filename[32] = SOUNDS_PATH "/"; // TODO not 32!
|
||||||
char *buf = strcat_modelname(&filename[sizeof(SOUNDS_PATH)], g_eeGeneral.currModel);
|
|
||||||
*buf++ = '/';
|
|
||||||
|
|
||||||
for (uint32_t i=0; i<MAX_PHASES; i++)
|
if (sd_card_mounted()) {
|
||||||
sdAvailablePhaseAudioFiles[i] = getAvailableFiles(strcat_phasename(buf, i), info, filename);
|
char *buf = strcat_modelname(&filename[sizeof(SOUNDS_PATH)], g_eeGeneral.currModel);
|
||||||
|
*buf++ = '/';
|
||||||
|
|
||||||
for (uint32_t i=0; i<MAX_MIXERS; i++)
|
for (uint32_t i=0; i<MAX_PHASES; i++) {
|
||||||
sdAvailableMixerAudioFiles[i] = getAvailableFiles(strcat_mixername(buf, i), info, filename);
|
sdAvailablePhaseAudioFiles[i] = getAvailableFiles(strcat_phasename_default(buf, i), info, filename) << 4;
|
||||||
|
char *tmp = strcat_phasename_nodefault(buf, i);
|
||||||
|
if (tmp != buf) sdAvailablePhaseAudioFiles[i] += getAvailableFiles(tmp, info, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i=0; i<MAX_MIXERS; i++) {
|
||||||
|
sdAvailableMixerAudioFiles[i] = getAvailableFiles(strcat_mixername_default(buf, i), info, filename) << 4;
|
||||||
|
char *tmp = strcat_mixername_nodefault(buf, i);
|
||||||
|
if (tmp != buf) sdAvailableMixerAudioFiles[i] += getAvailableFiles(tmp, info, filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SYSTEM_AUDIO_CATEGORY 0
|
bool isAudioFileAvailable(uint32_t i, char * filename)
|
||||||
#define MODEL_AUDIO_CATEGORY 1
|
|
||||||
#define PHASE_AUDIO_CATEGORY 2
|
|
||||||
#define MIXER_AUDIO_CATEGORY 3
|
|
||||||
|
|
||||||
inline bool isAudioFileAvailable(uint32_t i, char * filename)
|
|
||||||
{
|
{
|
||||||
uint8_t category = (i >> 24);
|
uint8_t category = (i >> 24);
|
||||||
|
|
||||||
if (category == SYSTEM_AUDIO_CATEGORY) {
|
if (category == SYSTEM_AUDIO_CATEGORY) {
|
||||||
if (sdAvailableSystemAudioFiles & ((uint32_t)1 << i)) {
|
if (sdAvailableSystemAudioFiles & ((uint32_t)1 << i)) {
|
||||||
|
strcpy(filename, SYSTEM_SOUNDS_PATH "/");
|
||||||
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]);
|
strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]);
|
||||||
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT);
|
strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
return false;
|
#if 0
|
||||||
|
else if (category == PHASE_AUDIO_CATEGORY) {
|
||||||
|
uint8_t index = (i >> 16) & 0xFF;
|
||||||
|
uint8_t event = i & 0xFF;
|
||||||
|
if (sdAvailablePhaseAudioFiles[index] & (1 << event)) {
|
||||||
|
strcpy(filename, SOUNDS_PATH "/");
|
||||||
|
char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
|
||||||
|
*str++ = '/';
|
||||||
|
char * tmp = strcat_phasename_nodefault(str, i);
|
||||||
|
if (tmp != str) {
|
||||||
|
strcpy(tmp, suffixes[event]);
|
||||||
|
strcat(tmp, SOUNDS_EXT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((sdAvailablePhaseAudioFiles[index] >> 4) & (1 << event)) {
|
||||||
|
strcpy(filename, SOUNDS_PATH "/");
|
||||||
|
char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
|
||||||
|
*str++ = '/';
|
||||||
|
char * tmp = strcat_phasename_default(str, i);
|
||||||
|
if (tmp != str) {
|
||||||
|
strcpy(tmp, suffixes[event]);
|
||||||
|
strcat(tmp, SOUNDS_EXT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (category == MIXER_AUDIO_CATEGORY) {
|
||||||
|
uint8_t index = (i >> 16) & 0xFF;
|
||||||
|
uint8_t event = i & 0xFF;
|
||||||
|
if (sdAvailableMixerAudioFiles[index] & (1 << event)) {
|
||||||
|
strcpy(filename, SOUNDS_PATH "/");
|
||||||
|
char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
|
||||||
|
*str++ = '/';
|
||||||
|
char * tmp = strcat_mixername_nodefault(str, i);
|
||||||
|
if (tmp != str) {
|
||||||
|
strcpy(tmp, suffixes[event]);
|
||||||
|
strcat(tmp, SOUNDS_EXT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((sdAvailableMixerAudioFiles[index] >> 4) & (1 << event)) {
|
||||||
|
strcpy(filename, SOUNDS_PATH "/");
|
||||||
|
char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
|
||||||
|
*str++ = '/';
|
||||||
|
char * tmp = strcat_mixername_default(str, i);
|
||||||
|
if (tmp != str) {
|
||||||
|
strcpy(tmp, suffixes[event]);
|
||||||
|
strcat(tmp, SOUNDS_EXT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define isAudioFileAvailable(i, f) false
|
#define isAudioFileAvailable(i, f) false
|
||||||
@@ -632,7 +687,7 @@ void AudioQueue::reset()
|
|||||||
void audioEvent(uint8_t e, uint8_t f)
|
void audioEvent(uint8_t e, uint8_t f)
|
||||||
{
|
{
|
||||||
#ifdef SDCARD
|
#ifdef SDCARD
|
||||||
char filename[32] = SYSTEM_SOUNDS_PATH "/";
|
char filename[32];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAPTIC
|
#ifdef HAPTIC
|
||||||
|
|||||||
@@ -170,6 +170,15 @@ void audioEvent(uint8_t e, uint8_t f=BEEP_DEFAULT_FREQ);
|
|||||||
|
|
||||||
#define AUDIO_HEARTBEAT()
|
#define AUDIO_HEARTBEAT()
|
||||||
|
|
||||||
|
#define SYSTEM_AUDIO_CATEGORY 0
|
||||||
|
#define MODEL_AUDIO_CATEGORY 1
|
||||||
|
#define PHASE_AUDIO_CATEGORY 2
|
||||||
|
#define MIXER_AUDIO_CATEGORY 3
|
||||||
|
|
||||||
|
#define AUDIO_EVENT_OFF 0
|
||||||
|
#define AUDIO_EVENT_ON 1
|
||||||
|
#define AUDIO_EVENT_BG 2
|
||||||
|
|
||||||
extern void pushPrompt(uint16_t prompt, uint8_t id=0);
|
extern void pushPrompt(uint16_t prompt, uint8_t id=0);
|
||||||
|
|
||||||
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id)
|
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id)
|
||||||
@@ -181,8 +190,13 @@ extern void pushPrompt(uint16_t prompt, uint8_t id=0);
|
|||||||
#define PLAY_FILE(f, flags, id) audioQueue.playFile((f), (flags), (id))
|
#define PLAY_FILE(f, flags, id) audioQueue.playFile((f), (flags), (id))
|
||||||
#define STOP_PLAY(id) audioQueue.stopPlay((id))
|
#define STOP_PLAY(id) audioQueue.stopPlay((id))
|
||||||
#define AUDIO_RESET() audioQueue.reset()
|
#define AUDIO_RESET() audioQueue.reset()
|
||||||
|
#define PLAY_PHASE_OFF(phase)
|
||||||
|
// do { char filename[42/*TODO check*/]; if (isAudioFileAvailable((PHASE_AUDIO_CATEGORY << 24) + (phase << 16) + AUDIO_EVENT_OFF, filename)) audioQueue.playFile(filename); } while (0)
|
||||||
|
#define PLAY_PHASE_ON(phase)
|
||||||
|
// do { char filename[42]; if (isAudioFileAvailable((PHASE_AUDIO_CATEGORY << 24) + (phase << 16) + AUDIO_EVENT_ON, filename)) audioQueue.playFile(filename); } while (0)
|
||||||
|
|
||||||
extern void refreshSystemAudioFiles();
|
extern void refreshSystemAudioFiles();
|
||||||
extern void refreshModelAudioFiles();
|
extern void refreshModelAudioFiles();
|
||||||
|
extern bool isAudioFileAvailable(uint32_t i, char * filename);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -541,9 +541,9 @@ extern uint32_t transSpeed;
|
|||||||
|
|
||||||
#define SD_CSD_READ_BL_LEN(pSd) SD_CSD(pSd, 80, 4) ///< Max. read data block length
|
#define SD_CSD_READ_BL_LEN(pSd) SD_CSD(pSd, 80, 4) ///< Max. read data block length
|
||||||
|
|
||||||
#define SD_CSD_BLOCK_LEN(pSd) (1 << SD_CSD_READ_BL_LEN(pSd))
|
#define SD_CSD_BLKLEN(pSd) (1 << (SD_CSD_READ_BL_LEN(pSd) - 9))
|
||||||
|
|
||||||
#define SD_CSD_BLOCKNR(pSd) ((SD_CSD_C_SIZE(pSd) + 1) * SD_CSD_MULT(pSd))
|
#define SD_CSD_BLOCKNR(pSd) ((SD_CSD_C_SIZE(pSd) + 1) * SD_CSD_MULT(pSd)) * SD_CSD_BLKLEN(pSd)
|
||||||
|
|
||||||
#define SD_CSD_BLOCKNR_HC(pSd) ((SD_CSD_C_SIZE_HC(pSd) + 1) * 1024)
|
#define SD_CSD_BLOCKNR_HC(pSd) ((SD_CSD_C_SIZE_HC(pSd) + 1) * 1024)
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void lcdSendCtl(uint8_t val)
|
|||||||
pioptr->PIO_SODR = LCD_CS1 ; // Deselect LCD
|
pioptr->PIO_SODR = LCD_CS1 ; // Deselect LCD
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_init()
|
void lcdInit()
|
||||||
{
|
{
|
||||||
register Pio *pioptr ;
|
register Pio *pioptr ;
|
||||||
// /home/thus/txt/datasheets/lcd/KS0713.pdf
|
// /home/thus/txt/datasheets/lcd/KS0713.pdf
|
||||||
@@ -207,7 +207,7 @@ void lcdSetRefVolt(uint8_t val)
|
|||||||
lcdLock = 0 ;
|
lcdLock = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshDisplay()
|
void lcdRefresh()
|
||||||
{
|
{
|
||||||
register Pio *pioptr;
|
register Pio *pioptr;
|
||||||
register uint8_t *p = displayBuf;
|
register uint8_t *p = displayBuf;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ volatile uint8_t LcdLock ;
|
|||||||
#define LCD_UNLOCK()
|
#define LCD_UNLOCK()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void lcd_init()
|
inline void lcdInit()
|
||||||
{
|
{
|
||||||
// /home/thus/txt/datasheets/lcd/KS0713.pdf
|
// /home/thus/txt/datasheets/lcd/KS0713.pdf
|
||||||
// ~/txt/flieger/ST7565RV17.pdf from http://www.glyn.de/content.asp?wdid=132&sid=
|
// ~/txt/flieger/ST7565RV17.pdf from http://www.glyn.de/content.asp?wdid=132&sid=
|
||||||
@@ -101,7 +101,7 @@ void lcdSetRefVolt(uint8_t val)
|
|||||||
LCD_UNLOCK();
|
LCD_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshDisplay()
|
void lcdRefresh()
|
||||||
{
|
{
|
||||||
LCD_LOCK();
|
LCD_LOCK();
|
||||||
uint8_t *p=displayBuf;
|
uint8_t *p=displayBuf;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ void Set_Address(u8 x, u8 y)
|
|||||||
WriteCommand(((y>>4)&0x0F)|0x70); //Set Row Address MSB RA [7:4]
|
WriteCommand(((y>>4)&0x0F)|0x70); //Set Row Address MSB RA [7:4]
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshDisplay()
|
void lcdRefresh()
|
||||||
{
|
{
|
||||||
for (uint8_t y=0; y<DISPLAY_H; y++) {
|
for (uint8_t y=0; y<DISPLAY_H; y++) {
|
||||||
Set_Address(0, y);
|
Set_Address(0, y);
|
||||||
@@ -112,7 +112,7 @@ static void LCD_Init()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_init()
|
void lcdInit()
|
||||||
{
|
{
|
||||||
LCD_BL_Config();
|
LCD_BL_Config();
|
||||||
LCD_Hardware_Init();
|
LCD_Hardware_Init();
|
||||||
|
|||||||
Reference in New Issue
Block a user