working basics

This commit is contained in:
Simon Stürz 2013-12-30 16:04:35 +01:00
parent 94f1f39070
commit 663e04f6c8
2 changed files with 10 additions and 13 deletions

View File

@ -66,9 +66,9 @@ bool RadioSwitch::isValid(QList<int> rawData)
QByteArray channelSettings; QByteArray channelSettings;
for(int i = 1; i < 10; i+=2){ for(int i = 1; i < 10; i+=2){
if(m_binCode.at(i-1) == '0' && m_binCode.at(i) == '1'){ if(m_binCode.at(i-1) == '0' && m_binCode.at(i) == '1'){
channelSettings.append("0"); channelSettings.append('0');
}else{ }else{
channelSettings.append("1"); channelSettings.append('1');
} }
} }
// get the button letter // get the button letter
@ -98,12 +98,10 @@ bool RadioSwitch::isValid(QList<int> rawData)
bool buttonStatus; bool buttonStatus;
if(byteList.last().toInt(0,2) == 1){ if(byteList.last().toInt(0,2) == 1){
buttonStatus = true; buttonStatus = true;
}else }
if(byteList.last().toInt(0,2) == 4){ if(byteList.last().toInt(0,2) == 4){
buttonStatus = false; buttonStatus = false;
}else{ }
return false;
}
qDebug() << "-----------------------------------------------------------"; qDebug() << "-----------------------------------------------------------";
qDebug() << "| REMOTE signal |"; qDebug() << "| REMOTE signal |";

View File

@ -150,8 +150,8 @@ void RadioReciver::handleInterrupt()
m_duration = currentTime - m_lastTime; m_duration = currentTime - m_lastTime;
// filter nois // filter nois
if (m_duration > 5000 && m_timings[0] - 200 && m_duration < m_timings[0] + 200){ if (m_duration > 5000 && m_duration > m_timings[0] - 200 && m_duration < m_timings[0] + 200){
//qDebug() << "dt " << m_duration; qDebug() << "dt " << m_duration;
m_repeatCount++; m_repeatCount++;
m_changeCount--; m_changeCount--;
@ -160,14 +160,13 @@ void RadioReciver::handleInterrupt()
// if we have a regular signal (1 bit sync + 48 bit data) // if we have a regular signal (1 bit sync + 48 bit data)
if(m_changeCount == RC_MAX_CHANGES){ if(m_changeCount == RC_MAX_CHANGES){
// write rawdata to a List and reset values to 0 // write rawdata to a List and reset values to 0
qDebug() << "detect protokol";
QList<int> rawData; QList<int> rawData;
for(int i = 0; i < RC_MAX_CHANGES; i++ ){ for(int i = 0; i < RC_MAX_CHANGES; i++ ){
rawData.append(m_timings[i]); rawData.append(m_timings[i]);
m_timings[i] = 0; m_timings[i] = 0;
} }
detectProtocol(rawData); detectProtocol(rawData);
}else{
//qDebug() << "changes: " << m_changeCount;
} }
m_repeatCount = 0; m_repeatCount = 0;
} }
@ -177,7 +176,7 @@ void RadioReciver::handleInterrupt()
m_changeCount = 0; m_changeCount = 0;
} }
if (m_changeCount >= RC_MAX_CHANGES) { if (m_changeCount >= RC_MAX_CHANGES+1) {
m_changeCount = 0; m_changeCount = 0;
m_repeatCount = 0; m_repeatCount = 0;
} }