0.5.0 HX711

This commit is contained in:
Rob Tillaart 2024-06-17 14:18:56 +02:00
parent 12257c41f9
commit 51f2cb1558
6 changed files with 30 additions and 16 deletions

View File

@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.5.0] - 2024-06-17
- fix #50, bug in constructor (thanks Mathieu!)
- refactor constructor
----
## [0.4.0] - 2024-03-02
- add fastProcessor option in **begin()** (Thanks to palmerr23)
- updated license

View File

@ -1,7 +1,7 @@
//
// FILE: HX711.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.4.0
// VERSION: 0.5.0
// PURPOSE: Library for load cells for UNO
// URL: https://github.com/RobTillaart/HX711_MP
// URL: https://github.com/RobTillaart/HX711
@ -12,7 +12,13 @@
HX711::HX711()
{
reset();
_gain = HX711_CHANNEL_A_GAIN_128;
_offset = 0;
_scale = 1;
_lastRead = 0;
_price = 0;
_mode = HX711_AVERAGE_MODE;
_fastProcessor = false;
}
@ -39,10 +45,11 @@ void HX711::reset()
{
power_down();
power_up();
_gain = HX711_CHANNEL_A_GAIN_128;
_offset = 0;
_scale = 1;
_gain = HX711_CHANNEL_A_GAIN_128;
_lastRead = 0;
_price = 0;
_mode = HX711_AVERAGE_MODE;
}

View File

@ -2,19 +2,20 @@
//
// FILE: HX711.h
// AUTHOR: Rob Tillaart
// VERSION: 0.4.0
// VERSION: 0.5.0
// PURPOSE: Library for load cells for Arduino
// URL: https://github.com/RobTillaart/HX711_MP
// URL: https://github.com/RobTillaart/HX711
//
// NOTES
// Superset of interface of HX711 class of Bogde
// float instead of long as float has 23 bits mantissa.
// uses float instead of long as float has 23 bits mantissa
// which almost perfectly matches the 24 bit ADC.
#include "Arduino.h"
#define HX711_LIB_VERSION (F("0.4.0"))
#define HX711_LIB_VERSION (F("0.5.0"))
const uint8_t HX711_AVERAGE_MODE = 0x00;
@ -175,16 +176,16 @@ private:
uint8_t _dataPin;
uint8_t _clockPin;
uint8_t _gain = 128; // default channel A
long _offset = 0;
float _scale = 1;
uint32_t _lastRead = 0;
float _price = 0;
uint8_t _mode = HX711_AVERAGE_MODE;
uint8_t _gain;
long _offset;
float _scale;
uint32_t _lastRead;
float _price;
uint8_t _mode;
bool _fastProcessor;
void _insertSort(float * array, uint8_t size);
uint8_t _shiftIn();
bool _fastProcessor = false;
};

View File

@ -386,7 +386,7 @@ See https://github.com/RobTillaart/HX711/issues/40
- example the adding scale
- void weight_clr(), void weight_add(), float weight_get() - adding scale
- decide pricing keep/not => move to .cpp
- add **setRate()** and **getRate()**
- add **setRate()** and **getRate()** - sample rate 10/80 SPS
- optional?

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/HX711"
},
"version": "0.4.0",
"version": "0.5.0",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=HX711
version=0.4.0
version=0.5.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for HX711 load cell amplifier