mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-02 13:14:51 +00:00
Keyborg: fix bug in slave data processing
This fixes two bugs: - The row order on the slave is reversed - The last value is missed when transferring data to the master BUG=None TEST=Build and check the heatmap BRANCH=None Change-Id: Ic51ad1132d948ec6ec68dc673288ec6f29c6ebe7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200621 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
9e2fac8390
commit
724cfbc6c4
@@ -140,7 +140,7 @@ void scan_column(uint8_t *data)
|
||||
|
||||
void touch_scan_slave_start(void)
|
||||
{
|
||||
int col, i;
|
||||
int col, i, v;
|
||||
struct spi_comm_packet *resp = (struct spi_comm_packet *)buf;
|
||||
|
||||
for (col = 0; col < COL_COUNT * 2; ++col) {
|
||||
@@ -155,10 +155,17 @@ void touch_scan_slave_start(void)
|
||||
scan_column(resp->data);
|
||||
resp->cmd_sts = EC_SUCCESS;
|
||||
|
||||
/* Reverse the scanned data */
|
||||
for (i = 0; ROW_COUNT - 1 - i > i; ++i) {
|
||||
v = resp->data[i];
|
||||
resp->data[i] = resp->data[ROW_COUNT - 1 - i];
|
||||
resp->data[ROW_COUNT - 1 - i] = v;
|
||||
}
|
||||
|
||||
/* Trim trailing zeros. */
|
||||
for (i = 0; i < ROW_COUNT; ++i)
|
||||
if (resp->data[i] >= THRESHOLD)
|
||||
resp->size = i;
|
||||
resp->size = i + 1;
|
||||
|
||||
/* Flush the last response */
|
||||
if (col != 0)
|
||||
|
||||
Reference in New Issue
Block a user