While accessing a class member variable the value seems to be corrupted

Created at 2021-08-15 09:05:28

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++;

}

image.png

更多

Follower
0
Views
535
1 Answer
RTThread_IoT_OS
RTThread_IoT_OS 2021-08-21

Will forward this question to the Support Team and get back to this post soon!

Write Your Answer

Log in to publish your answer,Click here to log in.

Create
Post

Share