Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: LambdaController.cpp
- Revision:
- 6:c4e901c6001a
- Parent:
- 5:57c6d5db3d52
- Child:
- 7:5b74ff881644
--- a/LambdaController.cpp Mon Aug 29 08:19:17 2016 +0000 +++ b/LambdaController.cpp Tue Sep 13 02:36:33 2016 +0000 @@ -27,7 +27,7 @@ buffer_head = 0; } - if (buffer_head < 10 && buffer_head != -1) { + if (buffer_head < 11 && buffer_head != -1) { received_buffer[buffer_head] = data; buffer_head++; } else { @@ -35,9 +35,9 @@ buffer_head = -1; } - if (buffer_head == 10) { + if (buffer_head == 11) { if(received_buffer[0] == 0x3A) { - for (i = 0; i < 10; i++) { + for (i = 0; i < 11; i++) { received_data[i] = received_buffer[i]; } @@ -62,15 +62,15 @@ } } -uint8_t LambdaController::get_all_switch() +uint16_t LambdaController::get_all_switch() { - return received_data[1]; + return (received_data[2] << 8) || received_data[1]; } bool LambdaController::get_switch(int num) { bool status = false; - if (num < 8 && num >= 0) { + if (num < 16 && num >= 0) { if (get_all_switch() & (1 << num)) { status = true; } else { @@ -89,7 +89,7 @@ int value; if((int)id < 4 && (int)id >= 0) { - data = &received_data[(int) id * 2 + 2]; + data = &received_data[(int) id * 2 + 3]; value = (data[0] << 8) | (data[1]); } else { value = -1;