Пример #1
0
int main(int argc, char *argv[])
{
    //
	printf("\n\n[LPM-Test]  Low Power Mode (LPM) Integration Test.\n");
  printf("[LPM-Test]  This test will detect when power is removed and then step through the Low Power states sequentially.\n");
  printf("[LPM-Test]  The proper sequence is: NORMAL -> BEGIN -> TEAR-DOWN -> STANDBY -> SUSPEND\n");
	printf("[LPM-Test]  The power cable and a charged battery should be attached.\n\n");

	// Android wants logging directly initialized
	//
  managerLogName = basename(argv[0]);
	initAndroidLogger(managerLogName);

	// register for android power events
        hal_battery_register(powerEventCallback);

	// start our state machine
	//
	initStateMachine();

	// start the test thread
	//
	lpmTestThread(NULL);

	// don't reach here, but put it here to make the compiler happy
	//
	return EXIT_SUCCESS;
}
Пример #2
0
bool CGameObject::init()
{
    initComponent();
    initStateMachine();
    initCommander();
    
    return true;
}
Пример #3
0
	void TradingSequenceRobot::init(
		HlpStruct::AlgBrokerDescriptor const& descriptor,
		BrkLib::BrokerBase* brokerlib, 
		CppUtils::String const& runName,
		CppUtils::String const& comment,
		TradeParam const& tradeParam, 
		CppUtils::StringMap const& symbolsFinam,
		CppUtils::StringMap const& symbolsSmartcom,
		CppUtils::StringMap const& symbolsSmartcomReverse, 
		CppUtils::StringSet const& syntheticSmartcomList
	)
	{
		symbolsFinamList_m =	symbolsFinam;
		symbolsSmartcomList_m = symbolsSmartcom;
		symbolsSmartcomReverse_m = symbolsSmartcomReverse;
		syntheticSmartcomList_m = syntheticSmartcomList;

		// 
		

		tradeParam_m = tradeParam;
		initStateMachine();

		// connect to broker
		
		brokerDialogReal_m.initAndConnect(  brokerlib, CppUtils::String(PAIR_TRADE) + "_real", runName, comment, base_m.getRtdataProvider_Smartcom() );
	
		if (!brokerDialogReal_m.isConnected()) {
			LOGEVENT(HlpStruct::CommonLog::LL_ERROR,  PAIR_TRADE, "onLibraryInitialized(...) session cannot be established: " << brokerDialogReal_m.getConnectString());
		}

		// broker connect 2
		
		brokerDialogDemo_m.initAndConnect(  base_m.getAlgHolder().getBroker2(), CppUtils::String(PAIR_TRADE) + "_simul", runName, comment, base_m.getRtdataProvider_Smartcom() );
		if (!brokerDialogDemo_m.isConnected()) {
			LOGEVENT(HlpStruct::CommonLog::LL_ERROR,  PAIR_TRADE, "onLibraryInitialized(...) session with broker lib 2 cannot be established: " << brokerDialogDemo_m.getConnectString());
		}


		if (tradeParam_m.isInvalid())
			THROW(CppUtils::OperationFailed, "exc_TradeParamsInvalid", "ctx_onLibraryInitialized", tradeParam_m.toDescriptionString() );

		calculatorLevel_m.initialized();
		

		LOG_COMMON(base_m.getRunName(), base_m.getRtdataProvider_Smartcom(), BrkLib::AP_MEDIUM, "Trading parameters: " << tradeParam_m.toDescriptionString());

	}
Пример #4
0
/*
*
* Carrega o arquivo com a maquina de estados e a inicializa
*CLASS_NAME
*/
void initConfigFile(FILE *sourceFile){
    printf("Carregando arquivo de configuracao\n");
	FILE *configFile;
	configFile = fopen("stateMachineConfig.txt", "r");
	if(configFile == NULL){
        printf("\nArquivo nao encontrado\n");
        return;
	}
	printf("Arquivo de configuracao carregado\n");
	printf("Criando state machine\n");
	STATEMACHINE = initStateMachine(configFile);
	if(STATEMACHINE){
        PrintStateMachine(STATEMACHINE);
	}
	printf("State machine criada\n");

    SOURCE_CODE = sourceFile;

    CURRENT_CHAR = fgetc(SOURCE_CODE);

	fclose(configFile);
}
Пример #5
0
bool GameScene::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!Scene::init());

		prevAngle = NOANGLE;
		prevPosition = NOCHOOSE;
		start = NOCHOOSE;
		end = NOCHOOSE;

		restFlag = false;

		lead = NULL;

		enoughPrepareColor = Color4F::MAGENTA;
		notEnoughPrepareColor = Color4F::GRAY;
		actionColor = Color4F::ORANGE;
		enoughColor = Color3B::GREEN;
		notEnoughColor = Color3B::RED;

		initMoveableLayerGroup();
		initControllerLayerGroup();
		initInformationLayerGroup();

		initData();
		createQuitButton();

		initStateMachine();
		scheduleUpdate();

		bRet = true;
	} while (0);
	return bRet;
}
Пример #6
0
int main()
{
	/* Perform processor initialization */

	sysinit();	
	
	printf("\nRunning the SolderTermo_v2 project.\r\n");
	
	initTime();

	initNVRAM();
	
	readNVRAM();	
	
	printf("Version %hd\tCRC %hd\r\n", nvram.Version, nvram.nvramCrc);

	initDisplay();

	//initMAX31855();
	initThermocoupleADC();

	initPowerPWM();

	initHMI();

	initButtons();

	initStateMachine();

	int fastLog = 0;
	while(1)
	{
		if (fastLog)
			printf("%hd\t%hd\r\n", vram.ADCVal, vram.CurrTemp);
		else
			printf("%hd\t%hd\t%hd\t%hd\t%hd\t%hd\r\n", vram.CurrTemp / 10, nvram.Tsp, vram.PWM_Sp,
					nvram.Kp, nvram.Ki, nvram.Kd);


		if ( UART_CharPresent(UART2) )
		{
			uint8_t c;
			uint8_t charNo = 0;
			memset(uartBuff, 0, UART_MAX_BUFF);
			printf("Finish your input by ENTER\r\n");
			printf("\r\n");
			do
			{
				c = uartBuff[charNo++] = UART_GetChar(UART2); // wait for char to come
				UART_PutChar(UART2, c);
				WAIT_Waitms(50);
			}
			while ( c != '\r' && charNo < UART_MAX_BUFF );

			switch(uartBuff[0])
			{
				case 'f': fastLog = 1; break;  // fast logging
				case 's': fastLog = 0; break;  // slow logging
				case 'p': nvram.Kp = atoi(uartBuff + 1); break;  // fast logging
				case 'i': nvram.Ki = atoi(uartBuff + 1); break;  // slow logging
				case 'd': nvram.Kd = atoi(uartBuff + 1); break;  // slow logging
			}
		}

		WAIT_Waitms(fastLog ? 20 : 200);
	}

	return 0; // should never come here
}