Skip to content

Instantly share code, notes, and snippets.

@chaeplin
Created February 5, 2016 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaeplin/fb39deae2a9c2986246a to your computer and use it in GitHub Desktop.
Save chaeplin/fb39deae2a9c2986246a to your computer and use it in GitHub Desktop.
struct data_size
typedef struct {
uint32_t _salt;
uint16_t volt;
int16_t data1;
int16_t data2;
uint8_t devid;
} data;
data sensor_data;
void setup() {
Serial.begin(115200);
Serial.println("");
Serial.println(sizeof(sensor_data));
}
void loop() {
}
@chaeplin
Copy link
Author

chaeplin commented Feb 5, 2016

!
typedef struct {
uint32_t _salt;
uint16_t volt;
int16_t data1;
} data;

--> pro mini : 8
--> esp : 8

typedef struct {
uint32_t _salt;
uint16_t volt;
int16_t data1;
uint8_t devid;
} data;

--> pro mini : 9
--> esp : 12

typedef struct {
uint32_t _salt;
uint16_t volt;
int16_t data1;
int16_t data2;
} data;

--> pro mini : 10
--> esp : 12

typedef struct {
uint32_t _salt;
uint16_t volt;
int16_t data1;
int16_t data2;
uint8_t devid;
} data;

--> pro mini : 11
--> esp : 12

@chaeplin
Copy link
Author

chaeplin commented Feb 5, 2016

me-no-dev:
AVR is 8 bit
ESP is 32bit
on the esp it goes in 4 byte steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment