Changed the way the filter system works in the CAN connection objects - now used only for sending frames immediately to relevant objects. Tested to work in firmware updater. Currently broken elsewhere. Also switched main frame update interval from 4 times per second to 8 to make things smoother.

This commit is contained in:
Collin Kidder
2016-12-29 19:13:51 -05:00
parent 96523cc082
commit beea680106
11 changed files with 172 additions and 87 deletions
+6 -7
View File
@@ -71,18 +71,17 @@ void ScriptContainer::setFilter(QJSValue id, QJSValue mask, QJSValue bus)
CANConnection* conn_p = CANConManager::getInstance()->getByName(mConName);
if(conn_p)
{
CANFlt canFlt;
for(int i=0 ; i<conn_p->getNumBuses() ; i++)
{
QVector<CANFlt> fltrs;
foreach(const CANFilter& flt, filters)
{
if(flt.bus==i) {
fltrs.append({flt.ID, flt.mask, true});
canFlt.id = idVal;
canFlt.mask = maskVal;
conn_p->addTargettedFrame(busVal, canFlt);
}
}
if(fltrs.size())
conn_p->setFilters(i, fltrs, false);
}
}
}
@@ -108,8 +107,8 @@ void ScriptContainer::clearFilters()
CANConnection* conn_p = CANConManager::getInstance()->getByName(mConName);
if(conn_p)
{
for(int i=0 ; i<conn_p->getNumBuses() ; i++)
conn_p->setFilters(i, QVector<CANFlt>(), false);
//for(int i=0 ; i<conn_p->getNumBuses() ; i++)
//conn_p->setFilters(i, QVector<CANFlt>(), false);
}
}