DlgPhaseParm::DlgPhaseParm(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DlgPhaseParm)
{
    ui->setupUi(this);
    this->com=new CPubSub();
    this->revtimer=new QTimer();
    this->timeout=new QTimer();
    connect(timeout,SIGNAL(timeout()),this,SLOT(warming()));

    ui->spinClearTime->clear();
    ui->spinCrossmsec->clear();
    ui->spinGreenFlash->clear();
    ui->spinGreenLaterTime->clear();
    ui->spinGreenTime->clear();

    ui->spinMaxTime->clear();
    ui->spinMaxTime2->clear();
    ui->spinMinGreenTime->clear();
    ui->radioFixed->setChecked(false);
    ui->radioKey->setChecked(false);
    ui->radioPlay->setChecked(false);
    ui->radioWait->setChecked(false);

    ui->check0->setChecked(false);
    ui->check1->setChecked(false);
    ui->check2->setChecked(false);
    ui->check3->setChecked(false);
    ui->check4->setChecked(false);
    ui->radionull->setChecked(true);
    ui->radiokong->setChecked(true);
    ui->radiokongong->setChecked(true);
    connect(revtimer,SIGNAL(timeout()),this,SLOT(rev()));
}
int DialogModelTab::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: rev(); break;
        case 1: warming(); break;
        case 2: send85((*reinterpret_cast< char(*)>(_a[1]))); break;
        case 3: on_butfind_clicked(); break;
        case 4: on_butfind2_clicked(); break;
        case 5: on_butfind3_clicked(); break;
        case 6: on_butfind4_clicked(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
int DlgStatus::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_butinit_clicked(); break;
        case 1: rev(); break;
        case 2: warming(); break;
        case 3: sendallb0(); break;
        case 4: sendd1(); break;
        case 5: setd1(); break;
        case 6: sendb1(); break;
        case 7: on_pushButton_clicked(); break;
        case 8: on_butquit_clicked(); break;
        case 9: on_butfind_clicked(); break;
        default: ;
        }
        _id -= 10;
    }
    return _id;
}
示例#4
0
//--------------------------------------------------------------
void ofApp::update(){
    
    //DISPLAYEJAR COMPTADOR-------------------------------------------
    
    if (isCounterOn)
    {
        timer = ofGetElapsedTimef()- counter;
        
        if (timer!= prevTimer)
            digit3+=1;
        if (digit3 == 10)
        {
            digit3 = 0;
            digit2 += 1;
            
            if (digit2 == 6)
            {
                digit2 = 0;
                digit1+=1;
                
            }
        }
        
        prevTimer = ofGetElapsedTimef()-counter;
    }
    
    if (timer == 0)
    {
        digit1 = 0;
        digit2 = 0;
        digit3 = 0;
        prevTimer = 0;
        
    }
    
    
    clock = std::string("0")+std::to_string(digit1)+":"+std::to_string(digit2)+std::to_string(digit3);
    // ---------------------------------------------------------------

    
    switch(appState){
        case STATE_IDLE:
            idle();
            break;
        case STATE_WARMING:
            warming();
            break;
        case STATE_PLAY:
            play();
            break;
        case STATE_POSTPLAY:
            postPlay();
            break;
        case STATE_CRISIS:
            crisis();
            break;
    }
    
    
    
    //gpio17.getval_gpio(state_buttonON);
    
    
    /////////// SERIAL ///////
    //unsigned char lectura[3];
    unsigned char* lectura;
	lectura = new unsigned char(' '); //[2] = {' ', ' '};
    serial.readBytes(lectura, 1);  //int readBytes(unsigned char * buffer, int length);
    
   cout << *lectura << endl;
    
   
    if (*lectura == 'Y'){
        buttonON = true;
        cout << "HE REBUT ON!!!!" << endl;
    }
    else {
        buttonON = false;
    
    }
    
    if (*lectura == 'N'){
        buttonOFF = true;
        cout << "HE REBUT OFF!!!!" << endl;
    }
    else {
        buttonOFF = false;
        
    }
    
//    if (ofToInt(state_buttonON) == 1){
//        buttonON = true;
//        cout << "ON!!" << endl;
//    }
//    else
//        buttonON = false;
//
//    gpio21.getval_gpio(state_button);
//    
//    
//    
//    if (ofToInt(state_button) == 1){
//        buttonOFF = true;
//        cout << "OFF!!" << endl;
//    }
//    else
//        buttonOFF = false;
    
    
    // LIGHT
    Light::getInstance().getInfo();
    
    //cout << appState << endl;
    
}