Beispiel #1
0
void main(void)
{
	s7sInit();
	chrgPmpInit();

	my_delay(200);

  // Button init
	button.oldState = 0x83;
	button.timeout =0;
	DDRD &= ~(0x3);
	DDRB &= ~(0x80);
  // Logic init




	*((uint16_t*)&calibr) = eeprom_read_word(&EE_Calibr);



	SREG|=1<<7;
	s7s.dat[0]=16;
	s7s.dat[1]=16;
	s7s.dat[2]=16;
	s7s.dat[3]=16;
	s7s.point=3;


	for(;;)
	{
		switch (loop.state)
		{
		case RUN:
			runLoop();
			break;
		case IDLE:
			idleLoop();
			break;
		case SET:
			setLoop();
			break;
		}
	}

}
Beispiel #2
0
bool MainLoop::processLoop(){
	while(sControl->read()){};
	if(sControl->isCtrlCommandReady()){
		fCtrlCommand = sControl->getCtrlCommand();
		cout << "Control command received " << (int)fCtrlCommand << endl;
		delay(100);
		if(fCtrlCommand==Constants::CtrlCommand::kDODEBUG) bigDebug = !bigDebug;
	}
	if(sControl->isSimpleKFactorsReady()){
		sAltitude->setKs(sControl->getSimpleKP(), sControl->getSimpleKD());
	}
	if(fState==kINITIALIZING) initializationLoop();
	else if(fState==kIDLE) idleLoop();
	else if(fState==kCALIBRATING) calibrationLoop();
	else if(fState==kFLYING) flightLoop();
	else if(fState==kSTILL) stillLoop();
	else{
		//Error, do something
	}
	return true;
}