//========================================================================= // Real-Time Clock //------------------------------------------------------------------------- __myevic__ void InitRTC() { if ( !gFlags.noclock ) { gFlags.has_x32 = !dfStatus.x32off; RTCStart( 0 ); } if ( gFlags.has_x32 ) { // Disable Light Sleep mode. dfStatus.lsloff = 1; UpdateDFTimer = 1; } else if ( !dfStatus.x32off ) { // Disable X32 dfStatus.x32off = 1; // Enable Light Sleep mode. dfStatus.lsloff = 0; UpdateDFTimer = 1; } gFlags.rtcinit = 1; time_t vvbase; vvbase = RTCReadRegister( RTCSPARE_VV_BASE ); if ( ( vvbase == 0 ) || ( vvbase % 86400 ) ) { vvbase = RTCGetEpoch( 0 ); vvbase -= vvbase % 86400; RTCWriteRegister( RTCSPARE_VV_BASE, vvbase ); RTCWriteRegister( RTCSPARE_VV_MJOULES, 0 ); } else { MilliJoules = RTCReadRegister( RTCSPARE_VV_MJOULES ); } }
//========================================================================= //----- (0000344C) -------------------------------------------------------- __myevic__ void StopFire() { // register const uint32_t lr __asm__("lr"); // uint32_t caller; // caller = lr; if ( ISVTCDUAL ) { GPIO_SetMode( PD, GPIO_PIN_PIN1_Msk, GPIO_MODE_INPUT ); } else if ( !ISCUBOID && !ISCUBO200 && !ISRX200S && !ISRX23 && !ISRX300 ) { GPIO_SetMode( PD, GPIO_PIN_PIN7_Msk, GPIO_MODE_INPUT ); } PC1 = 0; if ( !ISVTCDUAL ) PC3 = 0; BuckDuty = 0; PC0 = 0; BBC_Configure( BBC_PWMCH_BUCK, 0 ); BoostDuty = 0; PC2 = 0; BBC_Configure( BBC_PWMCH_BOOST, 0 ); SetADCState( 1, 0 ); SetADCState( 2, 0 ); if ( ISCUBO200 || ISRX200S || ISRX23 || ISRX300 ) { SetADCState( 15, 0 ); } if ( ISEGRIPII || ISEVICAIO ) { LEDTimer = 30; } if ( gFlags.firing ) { gFlags.firing = 0; if ( FireDuration > 5 ) { dfTimeCount += FireDuration; if ( dfTimeCount > 999999 ) dfTimeCount = 0; if ( ++dfPuffCount > 99999 ) dfPuffCount = 0; UpdatePTTimer = 80; } RTCWriteRegister( RTCSPARE_VV_MJOULES, MilliJoules ); if (( FireDuration * 10 >= dfPreheatTime ) || ( dfStatus.pcurve && FireDuration > 10 )) { PreheatDelay = dfPHDelay * 100; } } // myprintf( "StopFire from 0x%08x\n", caller ); AutoPuffTimer = 0; PreheatTimer = 0; LowBatVolts = 0; BatReadTimer = 200; }