Hi,
I have a class variable, it is initialized in constructor,
but later when a setter member function is called the variable seems to be having a corrupted value.
class WaterFlowMeter: public BaseMeterClass
{
rt_uint8_t m_flowSensEncoder; --> member variable
public:
WaterFlowMeter();
virtual ~WaterFlowMeter();
void setFlowSensEncoder(void);
rt_uint32_t getFlowSensEncoder(void);
void resetFlowSensEncoder(void);
void flowMeter_Init(void);
static WaterFlowMeter *pWaterFlowCmdHdr;
};
void WaterFlowMeter::setFlowSensEncoder(void)
{
/*
* Increment the variable when the Rising edge of the
* flow meter is triggered
*/
rt_kprintf("WFM Encoder = %d\n",m_flowSensEncoder); **--> a wrong value is printed out?????**
m_flowSensEncoder++;
}