Skip to content

Commit

Permalink
Merge pull request #4 from mp-se/dev
Browse files Browse the repository at this point in the history
Merge dev 0.5
  • Loading branch information
mp-se authored Feb 18, 2023
2 parents f07a26b + fcc29cb commit ecb5d49
Show file tree
Hide file tree
Showing 34 changed files with 6,307 additions and 12,983 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pio-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
git config --global advice.detachedHead false
- name: Run PlatformIO
run: pio run -e kegmon-release
run: pio run -e kegmon-release -e kegmon-async-release

- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version. https://github.com/marketplace/actions/add-commit
with:
Expand Down
Binary file modified bin/firmware.bin
Binary file not shown.
Binary file added bin/firmware_async.bin
Binary file not shown.
75 changes: 36 additions & 39 deletions html/calibration.htm
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,28 @@ <h2 class="accordion-header" id="headingCalibration">
<script type="text/javascript">
window.onload = start;

function getScale() {
console.log( "Fetching scale data" );
$('#spinner').show();
setButtonDisabled(true);

$.ajax( {
type: "GET",
url: "/api/scale",
//url: "../test/scale.json",
data: { },
success: function(result) {
showScaleJson(result);
setButtonDisabled(false);
$('#spinner').hide();
},
error: function(result) {
showError('Unable read scale.');
setButtonDisabled(false);
$('#spinner').hide(); }
} );
}

$("#tare-btn").click(function(e){
console.log( "Resetting scale #" + $("#scale-index").val() );
setButtonDisabled(true);
Expand All @@ -169,10 +191,10 @@ <h2 class="accordion-header" id="headingCalibration">
//url: "../test/scale.json",
data: { "scale-index": $("#scale-index").val() },
success: function(result) {
showSuccess('Scale is now reset to zero weight, procceed to step 2.');
showScaleJson(result);
setButtonDisabled(false);
$('#spinner').hide();
setTimeout(() => { getScale(); }, 1000);
setTimeout(() => { showSuccess('Scale is now reset to zero weight, procceed to step 2.'); }, 2000);
// setButtonDisabled(false);
// $('#spinner').hide();
},
error: function(result) {
showError('Unable reset scale to zero weight.');
Expand All @@ -191,10 +213,10 @@ <h2 class="accordion-header" id="headingCalibration">
//url: "../test/scale.json",
data: { weight: $("#weight").val(), "scale-index": $("#scale-index").val() },
success: function(result) {
showSuccess('Scale is now calibrated...');
showScaleJson(result);
setButtonDisabled(false);
$('#spinner').hide();
setTimeout(() => { getScale(); }, 1000);
setTimeout(() => { showSuccess('Scale is now calibrated...'); }, 2000);
// setButtonDisabled(false);
// $('#spinner').hide();
},
error: function(result) {
showError('Unable calculate factor.');
Expand All @@ -205,23 +227,9 @@ <h2 class="accordion-header" id="headingCalibration">

$("#test-btn").click(function(e){
console.log( "Reading scale #" + $("#scale-index").val());
setButtonDisabled(true);
$('#spinner').show();
$.ajax( {
type: "GET",
url: "/api/scale",
//url: "../test/scale.json",
data: { },
success: function(result) {
showScaleJson(result);
setButtonDisabled(false);
$('#spinner').hide();
},
error: function(result) {
showError('Unable read scale.');
setButtonDisabled(false);
$('#spinner').hide(); }
} );
setButtonDisabled(true);
setTimeout(() => { getScale(); }, 2000);
});

function showScaleJson(result) {
Expand Down Expand Up @@ -249,22 +257,11 @@ <h2 class="accordion-header" id="headingCalibration">
}

function start() {
setButtonDisabled(true);

var url = "/api/scale";
//var url = "/test/scale.json";
$('#spinner').show();
$.getJSON(url, function (result) {
console.log(result);
showScaleJson(result);
})
.fail(function () {
showError('Unable to get data from the device.');
})
.always(function () {
$('#spinner').hide();
setButtonDisabled(false);
});
setButtonDisabled(true);
getScale();
setButtonDisabled(false);
$('#spinner').hide();
}
</script>

Expand Down
107 changes: 106 additions & 1 deletion html/calibration.min.htm

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions html/config.htm
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,27 @@ <h2 class="accordion-header" id="headingAdv">
<i>These are used to determine how many reads done towards the HX711. Since we filter the values we should not need that many for normal operations but when doing calibration its important to have an accurate value.</i>
</div>
</div>

<div class="row mb-3">
<label for="scale-temp-formula1" class="col-sm-2 col-form-label">Scale temp compensation</label>
<div class="col-sm-5">
<input type="text" size="100" class="form-control" name="scale-temp-formula1" id="scale-temp-formula1" placeholder=""
data-bs-toggle="tooltip"
title="Formula to compensate for temperature (scale 1)">
</div>
<div class="col-sm-5">
<input type="text" size="100" class="form-control" name="scale-temp-formula2" id="scale-temp-formula2" placeholder=""
data-bs-toggle="tooltip"
title="Formula to compensate for temperature (scale 2)">
</div>
</div>

<div class="row mb-3">
<div class="col-sm-12">
<i>Formula for compensating for temperature. Empty disables feature. See documentation for examples.</i>
</div>
</div>

<!--
<hr>
Expand Down Expand Up @@ -511,6 +531,9 @@ <h2 class="accordion-header" id="headingAdv">
$("#brewspy-token1").val(cfg["brewspy-token1"]);
$("#brewspy-token2").val(cfg["brewspy-token2"]);

$("#scale-temp-formula1").val(cfg["scale-temp-formula1"]);
$("#scale-temp-formula2").val(cfg["scale-temp-formula2"]);

$("#mqtt-target").val(cfg["mqtt-target"]);
$("#mqtt-port").val(cfg["mqtt-port"]);
$("#mqtt-user").val(cfg["mqtt-user"]);
Expand Down
Loading

0 comments on commit ecb5d49

Please sign in to comment.