Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not a real issue Just a stupid question(?) #21

Closed
mrWheel opened this issue Mar 17, 2019 · 1 comment
Closed

not a real issue Just a stupid question(?) #21

mrWheel opened this issue Mar 17, 2019 · 1 comment

Comments

@mrWheel
Copy link

mrWheel commented Mar 17, 2019

Dear Matthijs,

I have this piece of code:

      slimmeMeter.loop();
.
.
.
      if (slimmeMeter.available()) {
        Debugf("read telegram [%d]\r\n", ++telegramCount);

        if (slimmeMeter.parse(&DSMRdata, &DSMRerror)) {  // Parse succesful, print result
          processData();
          if (Verbose1) {
            DSMRdata.applyEach(showValues());
            printData();
          }
          
        } else {                                    // Parser error, print error
          Debugf("Parse error %s\r\n", DSMRerror.c_str());
          telegramErrors++;
        }
        slimmeMeter.clear();  // reset DSMRdata ???
        
      } // if (slimmeMeter.available()) 

DSMRdata and DSMRerror are declaired globaly:

// Set up to read from the Serial port, and use VCC_ENABLE as the
// request pin. 
#ifdef VCC_ENABLE
  P1Reader slimmeMeter(&Serial, VCC_ENABLE);
#else
  P1Reader slimmeMeter(&Serial, 0);
#endif
MyData    DSMRdata;
String    DSMRerror;

but, after processing the first telegram, I keep getting this error for every next telegram:

Parse error XMX5LGBBLB2410065887
                    ^
                    Duplicate field

I was under the impression that slimmeMeter.clear() would clear (empty) the DSMRdata area .. but it seems not to.

Can/will you please elaborate how to clear DSMRdata in my setup (I need DSMRdata to be globally declared to fix/find some heap problems).

@mrWheel
Copy link
Author

mrWheel commented Mar 19, 2019

Found how to reset DSMRdata ..

   `DSMRdata = {}; // reset`

@mrWheel mrWheel closed this as completed Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant