[all] FSPLASH option added

[stock] +100bytes saved on Voice / Stock board
This commit is contained in:
bsongis
2012-10-29 19:21:43 +00:00
parent c8b51eb063
commit bc3539d777
6 changed files with 61 additions and 52 deletions
+3 -3
View File
@@ -401,11 +401,11 @@ void menuGeneralSetup(uint8_t event)
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
break;
#if defined(SPLASH)
#if defined(SPLASH) && !defined(FSPLASH)
case ITEM_SETUP_DISABLE_SPLASH:
{
uint8_t b = 1-g_eeGeneral.disableSplashScreen;
g_eeGeneral.disableSplashScreen = 1 - onoffMenuItem( b, RADIO_SETUP_2ND_COLUMN, y, STR_SPLASHSCREEN, attr, event ) ;
uint8_t b = 1-g_eeGeneral.splashMode;
g_eeGeneral.splashMode = 1 - onoffMenuItem( b, RADIO_SETUP_2ND_COLUMN, y, STR_SPLASHSCREEN, attr, event ) ;
break;
}
#endif
+12 -6
View File
@@ -102,7 +102,8 @@ enum BeeperMode {
uint16_t mAhUsed; \
uint32_t globalTimer; \
int8_t temperatureCalib; \
uint8_t btBaudrate
uint8_t btBaudrate; \
uint8_t optrexDisplay
#else
#define EXTRA_SKY9X_FIELDS
#define EXTRA_GENERAL_FIELDS \
@@ -123,6 +124,13 @@ enum BacklightMode {
e_backlight_mode_on
};
#if defined(FSPLASH) || defined(XSPLASH)
#define SPLASH_MODE uint8_t splashMode:3
#else
#define SPLASH_MODE uint8_t splashMode:1; \
uint8_t spare4:2
#endif
#define ALTERNATE_VIEW 0x10
PACK(typedef struct t_EEGeneral {
uint8_t version;
@@ -140,19 +148,17 @@ PACK(typedef struct t_EEGeneral {
uint8_t view; //index of subview in main scrren
int8_t spare1:3;
int8_t beeperMode:2;
uint8_t spare2:1;
uint8_t flashBeep:1;
uint8_t disableMemoryWarning:1;
uint8_t disableAlarmWarning:1;
uint8_t stickMode:2;
int8_t timezone:5;
uint8_t optrexDisplay:1;
uint8_t spare2:1;
uint8_t inactivityTimer;
uint8_t throttleReversed:1;
uint8_t minuteBeep:1;
uint8_t preBeep:1;
uint8_t flashBeep:1;
uint8_t disableSplashScreen:1;
uint8_t spare3:1;
SPLASH_MODE; /* 3bits */
int8_t hapticMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t filterInput;
uint8_t lightAutoOff;
+8 -9
View File
@@ -1077,13 +1077,9 @@ void backlightOn()
g_LightOffCounter = ((uint16_t)g_eeGeneral.lightAutoOff*250) << 1;
}
#ifdef SPLASH
#if defined(SPLASH)
#ifdef DSM2
#define SPLASH_NEEDED() (g_model.protocol != PROTO_DSM2 && !g_eeGeneral.disableSplashScreen)
#else
#define SPLASH_NEEDED() (!g_eeGeneral.disableSplashScreen)
#endif
#define SPLASH_NEEDED() (!IS_DSM2_PROTOCOL(g_model.protocol) && !g_eeGeneral.splashMode)
void doSplash()
{
@@ -1105,7 +1101,7 @@ void doSplash()
#endif
#if !defined(SIMU)
for(uint8_t i=0; i<32; i++)
for (uint8_t i=0; i<32; i++)
getADC_filt(); // init ADC array
#endif
@@ -1124,9 +1120,12 @@ void doSplash()
uint16_t tsum = stickMoveValue();
if(keyDown() || (tsum!=inacSum)) return; //wait for key release
#if defined(FSPLASH) || defined(XSPLASH)
if (!(g_eeGeneral.splashMode & 0x04))
#endif
if (keyDown() || (tsum!=inacSum)) return; // wait for key release
if (check_soft_power() > e_power_trainer) return; // Usb on or power off
if (check_soft_power() > e_power_trainer) return; // usb and power off
#if !defined(PCBSTD)
if (curTime < get_tmr10ms()) {
+4
View File
@@ -581,7 +581,11 @@ enum CswFunctions {
#define DSW_SWC 21
#define THRCHK_DEADBAND 16
#if defined(FSPLASH) || defined(XSPLASH)
#define SPLASH_TIMEOUT (g_eeGeneral.splashMode == 0 ? 60000/*infinite=10mn*/ : ((4*100) * (g_eeGeneral.splashMode & 0x03)))
#else
#define SPLASH_TIMEOUT (4*100) // 4 seconds
#endif
#define TRM_BASE TRM_LH_DWN
+29 -30
View File
@@ -35,19 +35,7 @@
struct t_voice Voice ;
void pushCustomPrompt(uint8_t value)
{
struct t_voice *vptr ;
vptr = voiceaddress() ;
if (vptr->VoiceQueueCount < VOICE_Q_LENGTH-1)
{
pushPrompt( 0xFF ) ;
pushPrompt( value ) ;
}
}
void pushPrompt(uint8_t value)
void pushPrompt16(uint16_t value)
{
#ifdef SIMU
printf("playFile(\"%04d.ad4\")\n", value); fflush(stdout);
@@ -58,11 +46,21 @@ void pushPrompt(uint8_t value)
if (vptr->VoiceQueueCount < VOICE_Q_LENGTH) {
vptr->VoiceQueue[vptr->VoiceQueueInIndex++] = value;
vptr->VoiceQueueInIndex &= (VOICE_Q_LENGTH - 1);
vptr->VoiceQueueInIndex &= (VOICE_Q_LENGTH - 1); // TODO flash saving?
vptr->VoiceQueueCount += 1;
}
}
void pushCustomPrompt(uint8_t value)
{
pushPrompt16(260+value);
}
void pushPrompt(uint8_t value)
{
pushPrompt16(value);
}
struct t_voice *voiceaddress()
{
return &Voice ;
@@ -79,19 +77,10 @@ void t_voice::voice_process(void)
PORTB |= (1 << OUT_B_LIGHT); // Latch clock high
if (VoiceQueueCount) {
VoiceSerial = VoiceQueue[VoiceQueueOutIndex++];
VoiceQueueOutIndex &= (VOICE_Q_LENGTH - 1);
VoiceQueueOutIndex &= (VOICE_Q_LENGTH - 1); // TODO flash saving
VoiceQueueCount -= 1;
if (VoiceShift) {
VoiceShift = 0;
VoiceSerial += 256;
}
VoiceTimer = 16;
if (VoiceSerial == 0xFF) { // Looking for Shift FF
VoiceShift = 1;
return;
}
if ((VoiceSerial & 0x1F8) == 0x1F0) { // Looking for sound volume 1F0-1F7
VoiceSerial |= 0xFF00;
VoiceTimer = 17;
if (VoiceSerial & 0x8000) { // Looking for sound volume 1F0-1F7
VoiceTimer = 40;
}
VoiceLatch &= ~VOICE_CLOCK_BIT & ~VOICE_DATA_BIT ;
@@ -109,9 +98,13 @@ void t_voice::voice_process(void)
}
}
else if (VoiceState == V_STARTUP) {
if (g_blinkTmr10ms > 150) { // Give module 1.5 secs to initialise
VoiceState = V_IDLE;
PORTB |= (1<<OUT_B_LIGHT) ; // Latch clock high
VoiceLatch |= VOICE_CLOCK_BIT | VOICE_DATA_BIT ;
PORTA_LCD_DAT = VoiceLatch ; // Latch data set
if (g_blinkTmr10ms > 60) { // Give module 1.4 secs to initialise
VoiceState = V_WAIT_START_BUSY_OFF ;
}
PORTB &= ~(1<<OUT_B_LIGHT) ; // Latch clock low
}
else if (VoiceState != V_CLOCKING) {
uint8_t busy;
@@ -123,7 +116,7 @@ void t_voice::voice_process(void)
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop"); // 4th nop added for Thomas9x (compared to er9x)
#endif
busy = PINB & 0x80;
DDRB |= (1 << OUT_B_LIGHT); // Change to output
@@ -140,7 +133,7 @@ void t_voice::voice_process(void)
}
else if (VoiceState == V_WAIT_BUSY_OFF) { // check for busy processing here
if (busy) { // Busy is inactive
VoiceTimer = 2;
VoiceTimer = 3;
VoiceState = V_WAIT_BUSY_DELAY;
}
}
@@ -149,6 +142,12 @@ void t_voice::voice_process(void)
VoiceState = V_IDLE;
}
}
else if (VoiceState == V_WAIT_START_BUSY_OFF) { // check for busy processing here
if (busy) { // Busy is inactive
VoiceTimer = 20 ;
VoiceState = V_WAIT_BUSY_DELAY ;
}
}
PORTB &= ~(1 << OUT_B_LIGHT); // Latch clock low
}
}
+5 -4
View File
@@ -38,7 +38,7 @@
#define BACKLIGHT_BIT 0x04
#define SPARE_BIT 0x08
#define VOICE_Q_LENGTH 16
#define VOICE_Q_LENGTH 8
// Voice states
#define V_STARTUP 0
@@ -47,33 +47,34 @@
#define V_WAIT_BUSY_ON 3
#define V_WAIT_BUSY_OFF 4
#define V_WAIT_BUSY_DELAY 5
#define V_WAIT_START_BUSY_OFF 6
#define PROMPT_SYSTEM_BASE 230
#define PROMPT_CUSTOM_BASE 256
struct t_voice
{
uint8_t VoiceQueue[VOICE_Q_LENGTH] ;
uint8_t Backlight ;
uint8_t VoiceLatch ;
uint8_t VoiceCounter ;
uint8_t VoiceTimer ;
uint16_t VoiceSerial ;
uint8_t VoiceState ;
uint8_t VoiceShift ;
uint8_t VoiceQueueCount ;
uint8_t VoiceQueueInIndex ;
uint8_t VoiceQueueOutIndex ;
uint8_t VoiceQueue[VOICE_Q_LENGTH] ;
void voice_process( void ) ;
};
extern void pushCustomPrompt( uint8_t value );
extern void pushPrompt( uint8_t value );
extern void pushPrompt16(uint16_t value);
extern struct t_voice *voiceaddress( void ) ;
extern struct t_voice Voice ;
#define SET_VOLUME(v) pushCustomPrompt((v) | 0xF0)
#define SET_VOLUME(v) pushPrompt16((v) | 0xFFF0)
inline bool isPlaying()
{