-
Notifications
You must be signed in to change notification settings - Fork 4
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
Half reading 32 bit register #2
Comments
Olá @sandroxGH, você está certo, eu também tive o mesmo problema. current_usage_1 = (node2.getResponseBuffer(0x01) / 1000.000f); para: assim quando os valores forem maiores, você irá conseguir ler sem problema. (sem o falso 0). Espero ter ajudado. |
Sí, lo resolví a tu manera.
Gracias por el apoyo, espero que también ayude a otros.
Il giorno lun 27 lug 2020 alle ore 20:39 Renato-REDS <
notifications@github.com> ha scritto:
… Olá @sandroxGH <https://github.com/sandroxGH>,
você está certo, tive o mesmo problema.
Para você ter a leitura completa dos valores de potência, energia e
corrente em 16 bits, troque as linhas:
current_usage_1 = (node2.getResponseBuffer(0x01) / 1000.000f);
active_power_1 = (node2.getResponseBuffer(0x03) / 10.0f);
active_energy_1 = (node2.getResponseBuffer(0x05) / 1000.0);
para:
current_usage_2 = (node2.getResponseBuffer(0x01) |
(node1.getResponseBuffer(0x02)) << 16) / 1000.000f;
active_power_2 = (node2.getResponseBuffer(0x03) |
(node1.getResponseBuffer(0x04)) << 16) / 10.0f;
active_energy_2 = (node2.getResponseBuffer(0x05) |
(node1.getResponseBuffer(0x06)) << 16) / 1000.0f;
assim quando os valores forem maiores, você irá conseguir ler sem
problema. (sem o falso 0).
Espero ter ajudado.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3P44XNPCC2XXMYZAHEABDR5XCXFANCNFSM4PHPM36A>
.
|
The current power and energy have 32 bit register with "nodeX.getResponseBuffer(0xXX)" can read only 16 bit is correct?
I think it looking the energy counter some time restart from 0 after have count 66.
The text was updated successfully, but these errors were encountered: