mirror of
https://github.com/anklimov/lighthub
synced 2025-12-09 21:29:49 +03:00
counter fix
This commit is contained in:
@@ -13,7 +13,8 @@ static int driverStatus = CST_UNKNOWN;
|
||||
void out_counter::getConfig()
|
||||
{
|
||||
if (!item) return;
|
||||
impulse = item->getFloatArg(0);
|
||||
impulse = item->getFloatArg(0)*TENS_BASE;
|
||||
|
||||
period = item->getFloatArg(1)*1000.0;
|
||||
//debugSerial<<"CTR: imp:"<<impulse<<" period:"<<period<<endl;
|
||||
}
|
||||
@@ -51,12 +52,14 @@ uint32_t timer = item->getExt();
|
||||
|
||||
itemCmd st;
|
||||
st.loadItem(item,FLAG_PARAMETERS|FLAG_COMMAND);
|
||||
float val = st.getFloat();
|
||||
//float val = st.getFloat();
|
||||
uint32_t val = st.getTens_raw();
|
||||
//short cmd = st.getCmd();
|
||||
debugSerial<<"CTR: tick val:"<<val<<endl;
|
||||
debugSerial<<"CTR: tick val:"<<val<< " + "<< impulse << endl;
|
||||
|
||||
val+=impulse;
|
||||
st.Float(val);
|
||||
//st.Float(val);
|
||||
st.Tens_raw(val);
|
||||
st.saveItem(item);
|
||||
debugSerial<<"CTR: tick saved val:"<<val<<endl;
|
||||
item->SendStatus(FLAG_PARAMETERS);
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override;
|
||||
|
||||
protected:
|
||||
float impulse;
|
||||
//float impulse;
|
||||
uint32_t impulse;
|
||||
uint32_t period;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user