www/getispindellog.php

Wed, 06 May 2020 14:14:14 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 06 May 2020 14:14:14 +0200
changeset 667
1246550451ca
parent 627
f1a7c14d5601
child 837
b5e2ff72cc73
permissions
-rw-r--r--

Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.

<?php

require_once('config.php');

if (isset($_GET["code"]))
	$code = $_GET["code"] . ' ' . $_GET["name"];
else
	$code = "CB0081 Keuls";

$filename = 'log/ispindel/' . $code . '.log';
if (! file_exists($filename)) {
        header("Content-type: application/json");
        echo '{}';
        exit;
}


/*
 * 2014-11-15 18:39:12,TEMPERATURE,PLATO,SG,BATTERY,ANGLE,INVERVAL,UUID
 *          |              |         |    |    |
 * datetime +              |         |    |    |
 * temperature ------------+         |    |    |
 * density plato --------------------+    |    |
 * density sg ----------------------------+    |
 * battery ------------------------------------+
 */
$handle = @fopen($filename, "r");
if ($handle) {
	$lines = 0;
	while (($buffer = fgets($handle, 4096)) !== false) {

		$buffer = preg_replace( "/\r|\n/", "", $buffer);
		$row = explode(",", $buffer);
		$lines++;

		$logs[] = array(
			'date' => $row[0],
			'temperature' => $row[1],
			'plato' => $row[2],
			'sg' => $row[3],
			'battery' => $row[4]
		);
	}
	if (!feof($handle)) {
		echo "Error: unexpected fgets() fail\n";
	}
	fclose($handle);
}
header("Content-type: application/json");
echo json_encode($logs);

mercurial