Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
superpenguin612 committed Nov 6, 2024
1 parent 7080d1e commit 3e51865
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,20 @@ HX711 HX711_Bus::encs[NUM_SENSORS] = {
void HX711_Bus::init() {
for (int i = 0; i < NUM_SENSORS; i++) {
encs[i].set_raw_mode();
encs[i].set_scale(SCALE_CALIBRATION[i]);
encs[i].begin(PIN_LIST[i * 2], PIN_LIST[i * 2 + 1]);
if (encs[i].is_ready()) {
encs[i].tare();
}
encs[i].set_gain(HX711_CHANNEL_A_GAIN_128);
encs[i].set_scale(SCALE_CALIBRATION[i]);
}
}

float HX711_Bus::read_scale(uint8_t id) {
if (encs[id].is_ready()) {
// since we could start with weight on the load cell, manually subtract zero point instead of
// taring
float val = encs[id].get_units(1);
float val = encs[id].get_units();
// if load cell is not returning any data, but HX711 is connected
if (val == 0)
return -1;
Expand Down

0 comments on commit 3e51865

Please sign in to comment.