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

Memory usage optimization #4

Open
Ciusss89 opened this issue Nov 23, 2019 · 0 comments
Open

Memory usage optimization #4

Ciusss89 opened this issue Nov 23, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Ciusss89
Copy link
Owner

Ciusss89 commented Nov 23, 2019

  1. files energy_meter/main.c and energy_meter/core.h
  2. In order to optimize the system resource, we have to reduce the memory required by tread sampling and logging.
char em_sampling_stack[THREAD_STACKSIZE_SMALL];
char em_logging_stack[THREAD_STACKSIZE_LARGE];
  1. Instead, to use a type double for the struct we can use two uint8_t to store the decimal and the unit part
/* @em_realtime contains all notable datas:
 * -rms_c/v▸     : real time values, they're update each sec
 * -rms_*_1m▸    : last minute average, they're update each 60 sec
 * -log_1m_ready : true when last minute average is ready
 */
struct em_realtime {
▸       double rms_c, rms_v;
▸       double rms_c_1m, rms_v_1m;
▸       bool log_1m_ready;
};

/* @em_loggin contains all temporary datas
 */
struct em_loggin {
▸       double c[60], v[60];
};
@Ciusss89 Ciusss89 added the enhancement New feature or request label Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant