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