working basics

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

View File

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