Skip to content

Commit

Permalink
Merge pull request #11 from ramonaoptics/use_unsigned_values
Browse files Browse the repository at this point in the history
Ensure that analog reads return unsigned values
  • Loading branch information
hmaarrfk authored Jul 14, 2021
2 parents 60535ea + fcd9d3f commit fd12baf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 0.0.16

* Bugfix: Ensure that analog reads return unsigned values.

### 0.0.15

* Add the ability to do analog reads.
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ int gpio_digital_read(CommandRouter *cmd, int argc, const char **argv) {
uint8_t pin = strtol(argv[1], nullptr, 0);
uint8_t value = digitalRead(pin);

snprintf(cmd->buffer, cmd->buffer_size, "%d", value);
snprintf(cmd->buffer, cmd->buffer_size, "%u", value);
return 0;
}

Expand All @@ -339,7 +339,7 @@ int analog_read(CommandRouter *cmd, int argc, const char **argv) {
uint8_t pin = strtol(argv[1], nullptr, 0);
uint8_t value = analogRead(pin);

snprintf(cmd->buffer, cmd->buffer_size, "%d", value);
snprintf(cmd->buffer, cmd->buffer_size, "%u", value);
return 0;
}

Expand Down

0 comments on commit fd12baf

Please sign in to comment.