예제 #1
0
void MainWindow::startSensorThread()
{
    sensorThread = new SensorThread();
    //QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), this, SLOT(printData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), this, SLOT(updateCursors(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::settingsWidget), SLOT(displayData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::homeWidget), SLOT(switchMenu(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::desktopWidget), SLOT(switchMenu(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::galleryWidget), SLOT(displayData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(connectionChanged(QString)), getWidget(WidgetType::loadingWidget), SLOT(updateSubtitle(QString)));
    QObject::connect(sensorThread, SIGNAL(initializationChanged(WidgetType)), this, SLOT(setActiveWidget(WidgetType)));
    QObject::connect(getWidget(WidgetType::homeWidget), SIGNAL(menuSelected(WidgetType)), this, SLOT(setActiveWidget(WidgetType)));
    QObject::connect(sensorThread, SIGNAL(finished()), sensorThread, SLOT(deleteLater()));
    for (int i = 0; i < widgetsList.size(); i++){
        QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), widgetsList[i], SLOT(collapse(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
        QObject::connect(widgetsList[i], SIGNAL(returnHome(WidgetType)), this, SLOT(setActiveWidget(WidgetType)));}
    sensorThread->start();
}
예제 #2
0
/**
* @~english
* @brief Print string on a specific line with given offset on the display
*
* @param buffer buffor of the string
* @param line number of the line (1,2)
* @param off number of elements for the offset
* @return 1 by success, -1 by failure
*
* @~german
* @brief Schreibt String in eine bestimmte Zeile mit gegebenem Offset auf das Displays
*
* @param buffer Buffer für den String
* @param line Zeilenenummer (1,2)
* @param off Anzahl der Positionen, um die verschoben werden soll
* @return 1 bei Erfolg, -1 im Fehlerfall
*/
int gnublin_module_dogm::print(char* buffer, int line, int off){
	error_flag = false;
	returnHome();
	if (line == 1){
		offset(off);
		print(buffer);
	}
	else if (line == 2) {
		off +=16;
		offset(off);
		print(buffer);
	}
	else {
		error_flag = true;
		return -1;
	}
	return -1;
}
예제 #3
0
/**
* @~english
* @brief Print string on a specific line of the display
*
* @param buffer buffor of the string
* @param line number of the line (1,2)
* @return 1 by success, -1 by failure
*
* @~german
* @brief Schreibt String in eine bestimmte Zeile des Displays
*
* @param buffer Buffer für den String
* @param line Zeilenenummer (1,2)
* @return 1 bei Erfolg, -1 im Fehlerfall
*/
int gnublin_module_dogm::print(char* buffer, int line){
	error_flag = false;
	if (returnHome() < 0){
		return -1;
	}
	if (line == 1){
		print(buffer);
	}
	else if (line == 2) {
		offset(16);
		print(buffer);
	}
	else {
		error_flag = true;
		return -1;
	}
	return -1;
}
예제 #4
0
Launcher::Launcher(bool multi, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Launcher)
{
    m_parent = parent;
    ui->setupUi(this);
    m_maps = readDirectory("./Maps/");
    // On écrit les maps dans la listView
    for (QStringList::iterator it = m_maps.begin(); it != m_maps.end(); ++it)
    {
        ui->listMaps->addItem(*it);
    }
    // signaux
    connect(ui->backButton, SIGNAL(clicked()), this, SLOT(returnHome()));
    connect(ui->listMaps, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(enableButtonPlay()));
    if (multi)
      connect(ui->btnPlay, SIGNAL(clicked()), this, SLOT(launchGame2()));
    else
      connect(ui->btnPlay,SIGNAL(clicked()), this, SLOT(launchGame1()));
}
예제 #5
0
파일: tvec.cpp 프로젝트: Octav14n/Goranth
Uint32 TVec::update() {
    printf("TVec::update!\n");

    switch (this->aktion) {
    case eVec::Action::Idle:
        if(!this->doIDLE()) {
            if (this->aktion == eVec::Action::Idle) {
                this->aktion = eVec::Action::Work;
                return 1;
            }
        }
        return 0;
        break;
    case eVec::Action::Rotate:
        if(!this->doROTATE()) {
            this->aktion = eVec::Action::Move;
        }
        return 1;
        break;
    case eVec::Action::Move:
        if(!this->doMOVE()) {
            this->aktion = eVec::Action::Work;
        }
        return 1;
        break;
    case eVec::Action::Work:
        if(this->doWORK() == 0) {
            this->aktion = eVec::Action::Idle;
            if (!isHome()) {
                returnHome();
            }
            return 0;
        }
        return this->nextWork;
        break;
    default:
        return 0;
        break;
    }
}
예제 #6
0
// Control callbacks
void exitCalendar(int x, int y)
{
	freeCalendar();	
	clearControls();
	returnHome();
}
예제 #7
0
void exitAbout(int x, int y)
{
	returnHome();
}
예제 #8
0
int main(void)
{
  /* MCU Configuration----------------------------------------------------------*/

  HAL_Init();	  													/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  SystemClock_Config(); 									/* Configure the system clock */
	ADC1_Config(); 													/* configure ADC1 */
	Display_GPIO_Config(); 									/* Configure 7-Segment Displays */
	Alarm_GPIO_Config(); 										/* Configure alarm pins */	
	initLCD(); 															/* configure LCD */

	/* print temperature on the first line of the LCD */
	returnHome(); 													/* just makes sure that start writing at the right place */
	LCD_WriteString("  Temperature"); 			/* The 2 initial space are for centering */
	

	
	adcState = malloc(sizeof(kalmanState)); /* Init Kalman Filter */
	kalmanInit(adcState, INIT_q, INIT_r, INIT_x, INIT_p, INIT_k);

	/* main program to run in this infinite loop */
	while (1)	{

		
		if (adcTimer >= ADC_PERIOD) { 								/* 100Hz */
			adcTimer = 0;
			HAL_ADC_Start(&ADC1_Handle); 								/* start ADC conversion */
			
			/* wait for the conversion to be done and get data */
			if (HAL_ADC_PollForConversion(&ADC1_Handle, 1000000) == HAL_OK) { 
				adc_val = HAL_ADC_GetValue(&ADC1_Handle); /* get the value */
				
				kalmanUpdate(adcState, adc_val); 					/* filter the data and update the filter parameters */
				/* DON'T DELETE printf for matlab script */
				//printf("%f,%f,%f,%f,%f,%f\n",adc_val, adcState->q,adcState->r, adcState->x, adcState->p, adcState->k);
				
				temp = convertTemp(adcState->x); 					/* convert the filterd value of the ADC into temperature */
				
				/* Alarm triggering  */
				if (temp > THRESHHOLD_TEMP) {
					if ( filterAlarmCounter > 5 ){ 					/* 5 consecutive to avoid false positive */
						trigger_alarm();
					}
					else {
					filterAlarmCounter++;
					}
				} 
				else {
					shutoff_alarm();
					filterAlarmCounter = 0;
				}
		
				/* Update Measurement to Display at 2Hz */
				if (updateMeasureForDisplayTimer >= UPDATE_MEASURE_PERIOD) {
					updateMeasureForDisplayTimer = 0; 						/* reset the displayTimer tick */
					displayTemp = temp;
					displayTemp = floor(10 * displayTemp) / 10; 	/* truncate to 1 decimal without rounding */
								
					/* LCD DISPLAY */	
					SetAdress(64); 																/* go to line 2 of LCD */
					sprintf(tempToLCD, "     %.1f", displayTemp); /* convert the float to a string and formats it */
					LCD_WriteString(tempToLCD);										/* print value to the LCD display */
					/* LCD DISPLAY END */
				}
			}
		}
		
		/* here display runs at DISPLAY_7_SEGMENT_PERIOD speed, but displayTemp gets updated at 2Hz */
		if(display7segTimer >= DISPLAY_7_SEGMENT_PERIOD) {
			display7segTimer = 0;
			display(displayTemp); 														/* display on 7-segment display */
		}
	
	}
}
예제 #9
0
void Banner::reloadData() {
	returnHome(); //! @note when datamanager is emptied, redirect to home to avoid pointing a potential empty area
	QWidget::update();
}