Search found 3 matches
- Wed May 21, 2025 11:56 am
- Forum: ESP32 Arduino
- Topic: ESP32 CALCULATION INVALID
- Replies: 5
- Views: 202
Re: ESP32 CALCULATION INVALID
@tomero Those two code fragments are equivalent, it doesn't change the calculation. And as far as we can see the code works fine. If you still do not think so, can you tell us what you expect, what you get, and why you think it is the wrong answer?
Yes as you say that code is equivalent, and I ...
- Mon May 19, 2025 7:33 am
- Forum: ESP32 Arduino
- Topic: ESP32 CALCULATION INVALID
- Replies: 5
- Views: 202
Re: ESP32 CALCULATION INVALID
Hi all, thank you for your response.
I have solution by modification the formula of 2's complement:
To
But im still confused, why its return different but in same purpose. 
I have solution by modification the formula of 2's complement:
Code: Select all
(((cs ^ 0xFF) + 1) & 0xFF);Code: Select all
((~cs + 1) & 0xFF);- Sat May 17, 2025 11:49 pm
- Forum: ESP32 Arduino
- Topic: ESP32 CALCULATION INVALID
- Replies: 5
- Views: 202
ESP32 CALCULATION INVALID
I try write some code to calculate some bytes, but the result is invalid, result should be "0x28". Please help.
void setup() {
Serial.begin(115200);
uint8_t data[] = {0x13, 0x00, 0x93, 0x00, 0x64, 0x09, 0xC4, 0x01, 0x7E, 0x8B, 0x01, 0x06, 0x00, 0x08, 0xE0, 0x02, 0x8E, 0x25, 0x00, 0x00, 0x00 ...
void setup() {
Serial.begin(115200);
uint8_t data[] = {0x13, 0x00, 0x93, 0x00, 0x64, 0x09, 0xC4, 0x01, 0x7E, 0x8B, 0x01, 0x06, 0x00, 0x08, 0xE0, 0x02, 0x8E, 0x25, 0x00, 0x00, 0x00 ...