int main(int argc, char **argv) { char *testStr; int nTimes = 0; int size = 0; int i = 0; if (argc < 3) { printUsage(argv[0]); return 0; } nTimes = atoi(argv[1]); size = atoi(argv[2]); srandom(19999); testStr = (char *) malloc(size); for(i = 0; i < size -1; ++i) { testStr[i] = 1 + random()%100; } testStr[size-1] = '\0'; // printf("libcStrlen: "); testFunc(size, nTimes, strlen); return 0; }
int main() { int i = 0, j = 1; for(; i < 3; i++) { j += i; sleep(1); } testFunc(1); for(i = 0; i < 1000; i++) { testFunc(); } recursF(2); recursF(10000); }
/* * A shared method to test proper activation during IdleTracker_Init() * or a direct call to IdleTracker_ActivateProcess() during regular * activation of an idle process. */ static void CheckForActivation(void (*testFunc)(void)) { static EventVersion fakeCurrentVersion = 10; CurrentVersion = &fakeCurrentVersion; InitFakeSessionState(0 /* activeProcessCount */, CLEANUP_COUNTDOWN_BEFORE_RUNAWAY /* cleanupCountdown */, RunawayStatus_NotRunaway /* runawayStatus */, 1 /* pinCount */, 0 /* vmem */); EventVersion oldVersion = *CurrentVersion; activationVersion = 0; deactivationVersion = 0; assert_true(*CurrentVersion != activationVersion); assert_true(*CurrentVersion != deactivationVersion); /* * Set to false as we want to verify that it gets set to true * once the testFunc() call returns */ isProcessActive = false; assert_true(MySessionState->activeProcessCount == 0); testFunc(); assert_true(activationVersion == *CurrentVersion); assert_true(deactivationVersion == 0); assert_true(isProcessActive == true); assert_true(MySessionState->activeProcessCount == 1); }
int main(int argc, char** argv){ int i = 0; void * ptr = &hello; printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Linked exe started <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n" ); printf(" hello = %x\n", ptr); // for (i=0; i<10; i++){ char buf[100]; sprintf(buf, "caller %d\n", i); printf("Calling hello(buf):\t"); hello(buf); hello1(); hello2(); hello3(); hello4(); hello5(); testFunc(); // } printf("PID == %d\n", getpid()); return 0; }
Server::Server( const QString &address, quint16 port, QObject *parent ) : QObject( parent ) { XmlRpcServer *srv = new XmlRpcServer; if ( srv->listen( QHostAddress( address ), port ) ) { srv->registerSlot( this, SLOT( testFunc(QVariant) ) ); } }
//---------------------------------------------------------------------- int main() { CUDA_CREATE array_type = ARRAY_2D; testFunc(); //testCudaCreate(array_type); exit(0); }
void tst_QInputDialog::timerEvent(QTimerEvent *event) { killTimer(event->timerId()); QInputDialog *dialog = qFindChild<QInputDialog *>(parent); Q_ASSERT(dialog); if (testFunc) testFunc(dialog); dialog->done(doneCode); // cause static function call to return }
void Driver::Wait(SYS::ConditionVariable& cvar, bool (*testFunc)()) { SYS::SpinLock mtx; mtx.Lock(); _isBlocked = true; while(!testFunc()) { cvar.Wait(mtx); } _isBlocked = false; mtx.Unlock(); }
int main(int argc, char* argv[]){ int a=6; int b=5; #ifdef mal5 a=5; #endif for (int i=0;i<argc;i++){ printf("argv[%d] = %s \n",i,argv[i]); } printf("hallo welt!, ich heiße %s \n das Ergebnis lautet: \n %d \n",__FILE__,a+b+testFunc("s")); return a+b; }
/* * A shared method to test proper deactivation during IdleTracker_Shutdown() * or a direct call to IdleTracker_DeactivateProcess() during regular * deactivation of an active process when a proper cleanup was done, throwing * and elog(ERROR,...) and therefore the call would never return to the calling * function */ static void CheckForDeactivationWithProperCleanup(void (*testFunc)(void)) { static EventVersion fakeCurrentVersion = 10; CurrentVersion = &fakeCurrentVersion; InitFakeSessionState(1 /* activeProcessCount */, CLEANUP_COUNTDOWN_BEFORE_RUNAWAY /* cleanupCountdown */, RunawayStatus_NotRunaway /* runawayStatus */, 1 /* pinCount */, 0 /* vmem */); EventVersion oldVersion = *CurrentVersion; /* Ensure we have a pending runaway event */ EventVersion fakeLatestRunawayVersion = *CurrentVersion - 1; latestRunawayVersion = &fakeLatestRunawayVersion; activationVersion = 0; deactivationVersion = 0; assert_true(*CurrentVersion != activationVersion); assert_true(*CurrentVersion != deactivationVersion); /* * Set to true as we want to verify that it gets set to false * once the testFunc() call returns */ isProcessActive = true; assert_true(MySessionState->activeProcessCount == 1); /* * Deactivation must call RunawayCleaner_StartCleanup before finishing deactivation * to check for cleanup requirement for any pending runaway event. The mocked method * is throwing an exception here, which would block execution of code following the call * site */ will_be_called_with_sideeffect(RunawayCleaner_StartCleanup, &_ExceptionalCondition, NULL); PG_TRY(); { testFunc(); assert_false("Expected an exception"); } PG_CATCH(); { } PG_END_TRY(); assert_true(activationVersion == 0); assert_true(deactivationVersion == *CurrentVersion); assert_true(isProcessActive == false); assert_true(MySessionState->activeProcessCount == 0); }
bool test_helper(int (* testFunc)(void), char * name) { int test_failcode = testFunc(); if(test_failcode != 0) printf("failed %s test with: %i \n", name, test_failcode); else printf("%s tests succeeded \n", name); return !test_failcode; }
void newtest(const std::string& info, void (*testFunc)(void) ) { size_t nOldSuccess = N_SUCCESS; size_t nOldFail = N_FAIL; size_t nOldTests = N_SUCCESS + N_FAIL; std::cout << " TEST: " << info << "..." << std::flush; testFunc(); std::cout << " " << N_SUCCESS - nOldSuccess << "/" << N_SUCCESS + N_FAIL - nOldTests << " OK " << std::flush; if ( N_FAIL > nOldFail ) { std::cout << " !! " << N_FAIL - nOldFail << " FAILURES !! " << std::flush; } std::cout << std::endl; printERRLOG(); }
int main() { int n, i = 3, count, c; n = 10; printf("Os primeiros %d numeros primos sao:\n", n); printf("2\n"); for (count = 2; count <= n;) { for (c = 2; c <= i - 1; c++) { if (i % c == 0) break; } if (c == i) { printf("%d\n", i); count++; } i++; } testFunc(--i); return 0; }
int32_t main(int32_t argc, char *(argv[])) { char *filename = "test_file.txt"; FILE *file = (void*)0; char *ok; assert(10 > 3); testFunc(10); assert(filename != (void*)0); assert(strcmp("w","r") == 0 || strcmp("w","w") == 0 || strcmp("w","a") == 0 || strcmp("w","r+") == 0 || strcmp("w","w+") == 0 || strcmp("w","a+") == 0); FILE *RetValTemp_2; RetValTemp_2 = fopen(filename, "w"); __CPROVER_assume(RetValTemp_2 != (void*)0); RetValTemp_2; assert(false); return 0; }
void FadeOutTRTiles::update(float time) { for (int i = 0; i < _gridSize.width; ++i) { for (int j = 0; j < _gridSize.height; ++j) { float distance = testFunc(Size(i, j), time); if ( distance == 0 ) { turnOffTile(Vec2(i, j)); } else if (distance < 1) { transformTile(Vec2(i, j), distance); } else { turnOnTile(Vec2(i, j)); } } } }
void outputProgress(const State4& state, const char* pathStr, ShapeOp op) { SkString testFunc("testShapeOp(path, pathB, "); testFunc += opStrs[op]; testFunc += ");"; const char* testFunction = testFunc.c_str(); if (gRunTestsInOneThread && gShowOutputProgress) { SkDebugf("%s\n", pathStr); SkDebugf(" %s\n", testFunction); } const char* nameSuffix = opSuffixes[op]; if (gUsePhysicalFiles) { SkFILEWStream outFile(state.filename); if (!outFile.isValid()) { SkASSERT(0); return; } outputToStream(state, pathStr, NULL, nameSuffix, testFunction, outFile); return; } SkFILEWStream outRam(state.filename); outputToStream(state, pathStr, NULL, nameSuffix, testFunction, outRam); }
vector<CCSprite*>* PuzzlePicLayer::getSpritesWithPic(const char* picAddr,int horizontal ,int vertical) { // if(m_pSprites.empty()) // { // // } CCSprite* pSprite = CCSprite::create(picAddr); if(NULL == pSprite) { CCMessageBox("create img fail","err"); return NULL; } m_picWidth = pSprite->getContentSize().width; m_picHight = pSprite->getContentSize().height; m_picCount = horizontal * vertical; m_picHorizontal = horizontal; m_picVertical = vertical; CCTexture2D* pTexture = pSprite->getTexture(); CCRect rect; float cellWidth = m_picWidth/horizontal; float cellHight = m_picHight/vertical; rect.size = CCSizeMake(cellWidth,cellHight); for(int i = 0 ; i < vertical ; i++) { for(int j = 0 ; j < horizontal ; j++) { rect.origin = ccp(j*cellWidth,i*cellHight); CCSprite* psp = CCSprite::create(picAddr,rect); psp->setTag(i*horizontal+j); psp->retain(); m_pSprites.push_back(psp); printf("create sprite with part:bp:%f,%f, rect:%f,%f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height); } } testFunc(); return &m_pSprites; }
void CCFadeOutTRTiles::update(ccTime time) { int i, j; for (i = 0; i < m_sGridSize.x; ++i) { for (j = 0; j < m_sGridSize.y; ++j) { float distance = testFunc(ccg(i, j), time); if ( distance == 0 ) { turnOffTile(ccg(i, j)); } else if (distance < 1) { transformTile(ccg(i, j), distance); } else { turnOnTile(ccg(i, j)); } } } }
void CCFadeOutTRTiles::update(float time) { int i, j; for (i = 0; i < m_sGridSize.width; ++i) { for (j = 0; j < m_sGridSize.height; ++j) { float distance = testFunc(CCSizeMake(i, j), time); if ( distance == 0 ) { turnOffTile(ccp(i, j)); } else if (distance < 1) { transformTile(ccp(i, j), distance); } else { turnOnTile(ccp(i, j)); } } } }
TEST( NamedRetVal, test ) { testFunc(); ASSERT_STREQ( outStr.c_str(), "foobar::foobar()\nfoobar::~foobar()\n" ); }
Expect* passTest(bool (*testFunc)(Te expected, Ta actual), Ta actual) { this->addTestResult(testFunc(this->expected, actual)); return this; };
/* * A shared method to test proper deactivation during IdleTracker_Shutdown() * or a direct call to IdleTracker_DeactivateProcess() during regular * deactivation of an active process when a proper cleanup was not possible * (e.g., a transaction is in progress). */ static void CheckForDeactivationWithoutCleanup(void (*testFunc)(void)) { static EventVersion fakeCurrentVersion = 10; CurrentVersion = &fakeCurrentVersion; InitFakeSessionState(1 /* activeProcessCount */, CLEANUP_COUNTDOWN_BEFORE_RUNAWAY /* cleanupCountdown */, RunawayStatus_NotRunaway /* runawayStatus */, 1 /* pinCount */, 0 /* vmem */); EventVersion oldVersion = *CurrentVersion; /* Ensure we have a pending runaway event */ EventVersion fakeLatestRunawayVersion = *CurrentVersion - 1; latestRunawayVersion = &fakeLatestRunawayVersion; activationVersion = 0; deactivationVersion = 0; assert_true(*CurrentVersion != activationVersion); assert_true(*CurrentVersion != deactivationVersion); /* * Set to true as we want to verify that it gets set to false * once the testFunc() call returns */ isProcessActive = true; assert_true(MySessionState->activeProcessCount == 1); /* * Deactivation must call RunawayCleaner_StartCleanup before finishing deactivation * to check for cleanup requirement for any pending runaway event. The method is * supposed to throw an exception, but for this test we are mocking the function * without side effect. I.e., the function behaves as if a proper cleanup is not * possible */ will_be_called(RunawayCleaner_StartCleanup); #ifdef USE_ASSERT_CHECKING will_return(RunawayCleaner_IsCleanupInProgress, true); /* * Expecting an exception as we are indicating an ongoing cleanup * and yet returning to IdleTracker_DactivateProcess */ EXPECT_EXCEPTION(); #endif PG_TRY(); { testFunc(); #ifdef USE_ASSERT_CHECKING assert_false("Expected an assertion failure"); #endif } PG_CATCH(); { } PG_END_TRY(); assert_true(activationVersion == 0); assert_true(deactivationVersion == *CurrentVersion); assert_true(isProcessActive == false); assert_true(MySessionState->activeProcessCount == 0); }
int main(int argc, char** argv) { if ( testFunc() ) return 1; return 0; }
/* * A shared method to test that the IdleTracker_DeactivateProcess ignores * deactivation for an already idle process when the proc_exit_inprogress * is set to true */ static void PreventDuplicateDeactivationDuringProcExit(void (*testFunc)(void)) { static EventVersion fakeCurrentVersion = 10; CurrentVersion = &fakeCurrentVersion; InitFakeSessionState(1 /* activeProcessCount */, CLEANUP_COUNTDOWN_BEFORE_RUNAWAY /* cleanupCountdown */, RunawayStatus_NotRunaway /* runawayStatus */, 1 /* pinCount */, 0 /* vmem */); EventVersion oldVersion = *CurrentVersion; /* Ensure we have a pending runaway event */ EventVersion fakeLatestRunawayVersion = *CurrentVersion - 1; latestRunawayVersion = &fakeLatestRunawayVersion; activationVersion = 0; deactivationVersion = 0; assert_true(*CurrentVersion != activationVersion); assert_true(*CurrentVersion != deactivationVersion); /* * Set to false to mark the process as deactivated */ isProcessActive = false; assert_true(MySessionState->activeProcessCount == 1); /* * Setting proc_exit_inprogress to true means we won't try to * deactivate an already idle process */ proc_exit_inprogress = true; /* Interrupts should be held off during proc_exit_inprogress*/ InterruptHoldoffCount = 1; /* Now the deactivation should succeed as we have held off interrupts */ testFunc(); InterruptHoldoffCount = 0; assert_true(activationVersion == deactivationVersion); assert_true(deactivationVersion != *CurrentVersion); assert_true(isProcessActive == false); /* We haven't reduced the activeProcessCount */ assert_true(MySessionState->activeProcessCount == 1); #ifdef USE_ASSERT_CHECKING /* * Now test that the testFunc fails assert if we try to deactivate an already * idle process during a normal execution (i.e., not proc_exit_inprogress) */ proc_exit_inprogress = false; EXPECT_EXCEPTION(); PG_TRY(); { testFunc(); assert_false("Expected assertion failure"); } PG_CATCH(); { } PG_END_TRY(); #endif }
void evalFunctions() #endif { MASK_FUNC_TYPE newActiveFunctions = 0; MASK_CFN_TYPE newActiveSwitches = 0; #if defined(ROTARY_ENCODERS) && defined(GVARS) static rotenc_t rePreviousValues[ROTARY_ENCODERS]; #endif #if defined(OVERRIDE_CHANNEL_FUNCTION) for (uint8_t i=0; i<NUM_CHNOUT; i++) { safetyCh[i] = OVERRIDE_CHANNEL_UNDEFINED; } #endif #if defined(GVARS) for (uint8_t i=0; i<NUM_STICKS; i++) { trimGvar[i] = -1; } #endif for (uint8_t i=0; i<NUM_CFN; i++) { const CustomFunctionData *cfn = &functions[i]; int8_t swtch = CFN_SWITCH(cfn); if (swtch) { MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i); #if defined(CPUARM) bool active = getSwitch(swtch, IS_PLAY_FUNC(CFN_FUNC(cfn)) ? GETSWITCH_MIDPOS_DELAY : 0); #else bool active = getSwitch(swtch); #endif if (HAS_ENABLE_PARAM(CFN_FUNC(cfn))) { active &= (bool)CFN_ACTIVE(cfn); } if (active || IS_PLAY_BOTH_FUNC(CFN_FUNC(cfn))) { switch (CFN_FUNC(cfn)) { #if defined(OVERRIDE_CHANNEL_FUNCTION) case FUNC_OVERRIDE_CHANNEL: safetyCh[CFN_CH_INDEX(cfn)] = CFN_PARAM(cfn); break; #endif case FUNC_TRAINER: { uint8_t mask = 0x0f; if (CFN_CH_INDEX(cfn) > 0) { mask = (1<<(CFN_CH_INDEX(cfn)-1)); } newActiveFunctions |= mask; break; } case FUNC_INSTANT_TRIM: newActiveFunctions |= (1 << FUNCTION_INSTANT_TRIM); if (!isFunctionActive(FUNCTION_INSTANT_TRIM)) { #if defined(GUI) if (g_menuStack[0] == menuMainView #if defined(FRSKY) || g_menuStack[0] == menuTelemetryFrsky #endif #if defined(PCBTARANIS) || g_menuStack[0] == menuMainViewChannelsMonitor || g_menuStack[0] == menuChannelsView #endif ) #endif { instantTrim(); } } break; case FUNC_RESET: switch (CFN_PARAM(cfn)) { case FUNC_RESET_TIMER1: case FUNC_RESET_TIMER2: #if defined(CPUARM) case FUNC_RESET_TIMER3: #endif timerReset(CFN_PARAM(cfn)); break; case FUNC_RESET_FLIGHT: flightReset(); break; #if defined(FRSKY) case FUNC_RESET_TELEMETRY: telemetryReset(); break; #endif #if ROTARY_ENCODERS > 0 case FUNC_RESET_ROTENC1: #if ROTARY_ENCODERS > 1 case FUNC_RESET_ROTENC2: #endif g_rotenc[CFN_PARAM(cfn)-FUNC_RESET_ROTENC1] = 0; break; #endif } #if defined(CPUARM) if (CFN_PARAM(cfn)>=FUNC_RESET_PARAM_FIRST_TELEM) { TelemetryItem * telemetryItem = & telemetryItems[CFN_PARAM(cfn)-FUNC_RESET_PARAM_FIRST_TELEM]; telemetryItem->clear(); } #endif break; #if defined(CPUARM) case FUNC_SET_TIMER: { timerSet(CFN_TIMER_INDEX(cfn), CFN_PARAM(cfn)); break; } #endif #if 0 //defined(DANGEROUS_MODULE_FUNCTIONS) case FUNC_RANGECHECK: case FUNC_BIND: case FUNC_MODULE_OFF: { unsigned int moduleIndex = CFN_PARAM(cfn); if (moduleIndex < NUM_MODULES) { moduleFlag[moduleIndex] = 1 + CFN_FUNC(cfn) - FUNC_RANGECHECK; } break; } #endif #if defined(GVARS) case FUNC_ADJUST_GVAR: if (CFN_GVAR_MODE(cfn) == 0) { SET_GVAR(CFN_GVAR_INDEX(cfn), CFN_PARAM(cfn), mixerCurrentFlightMode); } else if (CFN_GVAR_MODE(cfn) == 2) { SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_PARAM(cfn), mixerCurrentFlightMode), mixerCurrentFlightMode); } else if (CFN_GVAR_MODE(cfn) == 3) { if (!(functionsContext.activeSwitches & switch_mask)) { SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + (CFN_PARAM(cfn) ? +1 : -1), mixerCurrentFlightMode); } } else if (CFN_PARAM(cfn) >= MIXSRC_TrimRud && CFN_PARAM(cfn) <= MIXSRC_TrimAil) { trimGvar[CFN_PARAM(cfn)-MIXSRC_TrimRud] = CFN_GVAR_INDEX(cfn); } #if defined(ROTARY_ENCODERS) else if (CFN_PARAM(cfn) >= MIXSRC_REa && CFN_PARAM(cfn) < MIXSRC_TrimRud) { int8_t scroll = rePreviousValues[CFN_PARAM(cfn)-MIXSRC_REa] - (g_rotenc[CFN_PARAM(cfn)-MIXSRC_REa] / ROTARY_ENCODER_GRANULARITY); if (scroll) { SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightPhase(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, mixerCurrentFlightMode); } } #endif else { SET_GVAR(CFN_GVAR_INDEX(cfn), calcRESXto100(getValue(CFN_PARAM(cfn))), mixerCurrentFlightMode); } break; #endif #if defined(CPUARM) && defined(SDCARD) case FUNC_VOLUME: { getvalue_t raw = getValue(CFN_PARAM(cfn)); //only set volume if input changed more than hysteresis if (abs(requiredSpeakerVolumeRawLast - raw) > VOLUME_HYSTERESIS) { requiredSpeakerVolumeRawLast = raw; } requiredSpeakerVolume = ((1024 + requiredSpeakerVolumeRawLast) * VOLUME_LEVEL_MAX) / 2048; break; } #endif #if defined(CPUARM) && defined(SDCARD) case FUNC_PLAY_SOUND: case FUNC_PLAY_TRACK: case FUNC_PLAY_VALUE: #if defined(HAPTIC) case FUNC_HAPTIC: #endif { tmr10ms_t tmr10ms = get_tmr10ms(); uint8_t repeatParam = CFN_PLAY_REPEAT(cfn); if (!IS_SILENCE_PERIOD_ELAPSED() && repeatParam == CFN_PLAY_REPEAT_NOSTART) { functionsContext.lastFunctionTime[i] = tmr10ms; } if (!functionsContext.lastFunctionTime[i] || (repeatParam && repeatParam!=CFN_PLAY_REPEAT_NOSTART && (signed)(tmr10ms-functionsContext.lastFunctionTime[i])>=100*repeatParam)) { if (!IS_PLAYING(i+1)) { functionsContext.lastFunctionTime[i] = tmr10ms; if (CFN_FUNC(cfn) == FUNC_PLAY_SOUND) { AUDIO_PLAY(AU_FRSKY_FIRST+CFN_PARAM(cfn)); } else if (CFN_FUNC(cfn) == FUNC_PLAY_VALUE) { PLAY_VALUE(CFN_PARAM(cfn), i+1); } #if defined(HAPTIC) else if (CFN_FUNC(cfn) == FUNC_HAPTIC) { haptic.event(AU_FRSKY_LAST+CFN_PARAM(cfn)); } #endif else { playCustomFunctionFile(cfn, i+1); } } } break; } case FUNC_BACKGND_MUSIC: newActiveFunctions |= (1 << FUNCTION_BACKGND_MUSIC); if (!IS_PLAYING(i+1)) { playCustomFunctionFile(cfn, i+1); } break; case FUNC_BACKGND_MUSIC_PAUSE: newActiveFunctions |= (1 << FUNCTION_BACKGND_MUSIC_PAUSE); break; #elif defined(VOICE) case FUNC_PLAY_SOUND: case FUNC_PLAY_TRACK: case FUNC_PLAY_BOTH: case FUNC_PLAY_VALUE: { tmr10ms_t tmr10ms = get_tmr10ms(); uint8_t repeatParam = CFN_PLAY_REPEAT(cfn); if (!functionsContext.lastFunctionTime[i] || (CFN_FUNC(cfn)==FUNC_PLAY_BOTH && active!=(bool)(functionsContext.activeSwitches&switch_mask)) || (repeatParam && (signed)(tmr10ms-functionsContext.lastFunctionTime[i])>=1000*repeatParam)) { functionsContext.lastFunctionTime[i] = tmr10ms; uint8_t param = CFN_PARAM(cfn); if (CFN_FUNC(cfn) == FUNC_PLAY_SOUND) { AUDIO_PLAY(AU_FRSKY_FIRST+param); } else if (CFN_FUNC(cfn) == FUNC_PLAY_VALUE) { PLAY_VALUE(param, i+1); } else { #if defined(GVARS) if (CFN_FUNC(cfn) == FUNC_PLAY_TRACK && param > 250) param = GVAR_VALUE(param-251, getGVarFlightPhase(mixerCurrentFlightMode, param-251)); #endif PUSH_CUSTOM_PROMPT(active ? param : param+1, i+1); } } if (!active) { // PLAY_BOTH would change activeFnSwitches otherwise switch_mask = 0; } break; } #else case FUNC_PLAY_SOUND: { tmr10ms_t tmr10ms = get_tmr10ms(); uint8_t repeatParam = CFN_PLAY_REPEAT(cfn); if (!functionsContext.lastFunctionTime[i] || (repeatParam && (signed)(tmr10ms-functionsContext.lastFunctionTime[i])>=1000*repeatParam)) { functionsContext.lastFunctionTime[i] = tmr10ms; AUDIO_PLAY(AU_FRSKY_FIRST+CFN_PARAM(cfn)); } break; } #endif #if defined(FRSKY) && defined(VARIO) case FUNC_VARIO: newActiveFunctions |= (1 << FUNCTION_VARIO); break; #endif #if defined(HAPTIC) && !defined(CPUARM) case FUNC_HAPTIC: { tmr10ms_t tmr10ms = get_tmr10ms(); uint8_t repeatParam = CFN_PLAY_REPEAT(cfn); if (!functionsContext.lastFunctionTime[i] || (repeatParam && (signed)(tmr10ms-functionsContext.lastFunctionTime[i])>=1000*repeatParam)) { functionsContext.lastFunctionTime[i] = tmr10ms; haptic.event(AU_FRSKY_LAST+CFN_PARAM(cfn)); } break; } #endif #if defined(SDCARD) case FUNC_LOGS: if (CFN_PARAM(cfn)) { newActiveFunctions |= (1 << FUNCTION_LOGS); logDelay = CFN_PARAM(cfn); } break; #endif case FUNC_BACKLIGHT: newActiveFunctions |= (1 << FUNCTION_BACKLIGHT); break; #if defined(PCBTARANIS) case FUNC_SCREENSHOT: if (!(functionsContext.activeSwitches & switch_mask)) { requestScreenshot = true; } break; #endif #if defined(DEBUG) case FUNC_TEST: testFunc(); break; #endif } newActiveSwitches |= switch_mask; } else { functionsContext.lastFunctionTime[i] = 0; } } } functionsContext.activeSwitches = newActiveSwitches; functionsContext.activeFunctions = newActiveFunctions; #if defined(ROTARY_ENCODERS) && defined(GVARS) for (uint8_t i=0; i<ROTARY_ENCODERS; i++) { rePreviousValues[i] = (g_rotenc[i] / ROTARY_ENCODER_GRANULARITY); } #endif }