Skip to content

Commit

Permalink
deploy: e3701f4
Browse files Browse the repository at this point in the history
  • Loading branch information
loostrum committed Jul 14, 2023
1 parent 5a0379e commit 405e381
Show file tree
Hide file tree
Showing 55 changed files with 247 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: e342006711a4c0ea2922e717d503cdf0
config: ccbc9cc7b527bde9a9f7a39638c3f3b0
tags: 645f666f9bcd5a90fca523b33c5a78b7
2 changes: 1 addition & 1 deletion CONTRIBUTING.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contributing guidelines &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Contributing guidelines &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
10 changes: 5 additions & 5 deletions INSTALLATION_DEVICE.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Device installation guide &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Device installation guide &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down Expand Up @@ -136,7 +136,7 @@ <h2>Installing the PowerSensor<a class="headerlink" href="#installing-the-powers
</section>
<section id="building-the-firmware">
<h2>Building the firmware<a class="headerlink" href="#building-the-firmware" title="Permalink to this heading"></a></h2>
<p>We provide pre-built binaries <a class="reference external" href="https://github.com/nlesc-recruit/PowerSensor3/releases">here</a> for default configurations using either an STM32F401 or STM32F407 microcontrollers. For non-default settings or other customizations, the firmware can be built with the Arduino toolkit as outlined in this section. Note that the pre-built binaries use a modified USB transmit buffer size, see the <a class="reference internal" href="#usb-buffer-size"><span class="xref myst">USB Buffer size</span></a> section.</p>
<p>We provide pre-built binaries <a class="reference external" href="https://github.com/nlesc-recruit/PowerSensor3/releases">here</a> for default configurations using either any of the supported microcontrollers. For non-default settings or other customizations, the firmware can be built with the Arduino toolkit as outlined in this section. Note that the pre-built binaries use a modified USB transmit buffer size, see the <a class="reference internal" href="#usb-buffer-size"><span class="xref myst">USB Buffer size</span></a> section.</p>
<p>The firmware is dependent on a few Arduino tools, these should be installed before continueing. First the <a class="reference external" href="https://github.com/arduino/arduino-cli">arduino-cli</a> package can be installed on Linux via:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
</pre></div>
Expand Down Expand Up @@ -165,7 +165,7 @@ <h2>Building the firmware<a class="headerlink" href="#building-the-firmware" tit
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make device
</pre></div>
</div>
<p>For an STM32F401 Black Pill, the fimware will be written to <code class="docutils literal notranslate"><span class="pre">PowerSensor/build/STMicroelectronics.stm32.GenF4/PowerSensor.ino.bin</span></code></p>
<p>For an STM32F401 or STM32F411 Black Pill, the fimware will be written to <code class="docutils literal notranslate"><span class="pre">PowerSensor/build/STMicroelectronics.stm32.GenF4/PowerSensor.ino.bin</span></code>, for the STM32F407 Discovery, the file location is <code class="docutils literal notranslate"><span class="pre">PowerSensor/build/STMicroelectronics.stm32.Disco/PowerSensor.ino.bin</span></code>.</p>
<section id="uploading-the-firmware">
<h3>Uploading the firmware<a class="headerlink" href="#uploading-the-firmware" title="Permalink to this heading"></a></h3>
<p>First make sure the device is booted in DFU mode. This is typically achieved by holding down the BOOT0 button and pressing the RESET button. Confirm that the device has entered DFU mode with either:</p>
Expand All @@ -192,9 +192,9 @@ <h3>Build customization<a class="headerlink" href="#build-customization" title="
</section>
<section id="target-microcontroller">
<h2>Target microcontroller<a class="headerlink" href="#target-microcontroller" title="Permalink to this heading"></a></h2>
<p>We provided a flag to set whether the firmware is built for an STM32F401 (default) or STM32F407 microcontroller.<br />
<p>A flag is provided to set whether the firmware is built for an STM32F401, STM32F411 (default) or STM32F407 microcontroller.<br />
Option name: DEV<br />
Allowed values: F401, F407<br />
Allowed values: F401, F411, F407<br />
Example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make upload DEV=&quot;F401&quot;
</pre></div>
Expand Down
2 changes: 1 addition & 1 deletion INSTALLATION_HOST.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Host library installation guide &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Host library installation guide &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
2 changes: 1 addition & 1 deletion USERGUIDE.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>User guide &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>User guide &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
8 changes: 4 additions & 4 deletions _sources/INSTALLATION_DEVICE.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ATX 8-pin | 12 | 150 | 12.5
After connecting all relevant power cable, connect the microcontroller to a USB port on the host. After making sure that everything is connected correctly, turn on the host system.

## Building the firmware
We provide pre-built binaries [here](https://github.com/nlesc-recruit/PowerSensor3/releases) for default configurations using either an STM32F401 or STM32F407 microcontrollers. For non-default settings or other customizations, the firmware can be built with the Arduino toolkit as outlined in this section. Note that the pre-built binaries use a modified USB transmit buffer size, see the [USB Buffer size](#usb-buffer-size) section.
We provide pre-built binaries [here](https://github.com/nlesc-recruit/PowerSensor3/releases) for default configurations using either any of the supported microcontrollers. For non-default settings or other customizations, the firmware can be built with the Arduino toolkit as outlined in this section. Note that the pre-built binaries use a modified USB transmit buffer size, see the [USB Buffer size](#usb-buffer-size) section.


The firmware is dependent on a few Arduino tools, these should be installed before continueing. First the [arduino-cli](https://github.com/arduino/arduino-cli) package can be installed on Linux via:
Expand Down Expand Up @@ -46,7 +46,7 @@ Then run the following command in the device folder to build the firmware with d

make device

For an STM32F401 Black Pill, the fimware will be written to `PowerSensor/build/STMicroelectronics.stm32.GenF4/PowerSensor.ino.bin`
For an STM32F401 or STM32F411 Black Pill, the fimware will be written to `PowerSensor/build/STMicroelectronics.stm32.GenF4/PowerSensor.ino.bin`, for the STM32F407 Discovery, the file location is `PowerSensor/build/STMicroelectronics.stm32.Disco/PowerSensor.ino.bin`.

### Uploading the firmware
First make sure the device is booted in DFU mode. This is typically achieved by holding down the BOOT0 button and pressing the RESET button. Confirm that the device has entered DFU mode with either:
Expand All @@ -70,9 +70,9 @@ If the firmware is uploaded successfully, the device will be reset and start run
There are several options available to customize the firmware build. These options can be append to the `make device` and `make upload` commands.

## Target microcontroller
We provided a flag to set whether the firmware is built for an STM32F401 (default) or STM32F407 microcontroller.
A flag is provided to set whether the firmware is built for an STM32F401, STM32F411 (default) or STM32F407 microcontroller.
Option name: DEV
Allowed values: F401, F407
Allowed values: F401, F411, F407
Example:

make upload DEV="F401"
Expand Down
2 changes: 2 additions & 0 deletions _sources/api/file_host_include_PowerSensor.hpp.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ Variables

- :ref:`exhale_variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752`

- :ref:`exhale_variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056`

- :ref:`exhale_variable_PowerSensor_8hpp_1ae0c4657f6b5d13ad46465ee685a1fb1a`

- :ref:`exhale_variable_PowerSensor_8hpp_1ac518d2e94791ccc6f84de95271e52c76`
Expand Down
2 changes: 2 additions & 0 deletions _sources/api/namespace_PowerSensor3.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ Variables

- :ref:`exhale_variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752`

- :ref:`exhale_variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056`

- :ref:`exhale_variable_PowerSensor_8hpp_1ae0c4657f6b5d13ad46465ee685a1fb1a`
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Program Listing for File PowerSensor.hpp
static const unsigned MAX_PAIRS = MAX_SENSORS / 2;
static const float VOLTAGE = 3.3;
static const unsigned MAX_LEVEL = 1023;
static const std::string POWERSENSOR_VERSION = "1.3.0";
struct State {
std::array<double, MAX_PAIRS> consumedEnergy;
Expand All @@ -51,7 +52,6 @@ Program Listing for File PowerSensor.hpp
void dump(const std::string dumpFileName); // dumpFileName == 0 --> stop dumping
void mark(char name);
void mark(const State &startState, const State &stopState, const std::string name = 0, unsigned int tag = 0) const;
bool toggleDisplay();
void writeSensorsToEEPROM();
void setType(unsigned int sensorID, const std::string type);
Expand All @@ -73,7 +73,6 @@ Program Listing for File PowerSensor.hpp
std::queue<char> markers;
void writeMarker();
unsigned int numActiveSensors;
void initializeSensorPairs();
void updateSensorPairs();
Expand Down
33 changes: 5 additions & 28 deletions _sources/api/program_listing_file_host_src_PowerSensor.cc.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ Program Listing for File PowerSensor.cc
}
void PowerSensor::initializeSensorPairs() {
numActiveSensors = 0;
for (uint8_t pairID = 0; pairID < MAX_PAIRS; pairID++) {
sensorPairs[pairID].timeAtLastMeasurement = startTime;
sensorPairs[pairID].wattAtLastMeasurement = 0;
Expand All @@ -224,7 +223,6 @@ Program Listing for File PowerSensor.cc
if (currentSensorActive && voltageSensorActive) {
sensorPairs[pairID].inUse = true;
numActiveSensors += 2;
} else if (currentSensorActive ^ voltageSensorActive) {
std::cerr << "Found incompatible sensor pair: current sensor (ID " << 2*pairID << ") "
"is " << (currentSensorActive ? "" : "not ") << "active, while "
Expand Down Expand Up @@ -286,35 +284,14 @@ Program Listing for File PowerSensor.cc
}
}
bool PowerSensor::toggleDisplay() {
// ensure no data is streaming to host
stopIOThread();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
// drain any remaining incoming data
tcflush(fd, TCIFLUSH);
writeCharToDevice('D');
// if the display is now on, the device sends and L, else l
char buffer;
buffer = readCharFromDevice();
if (buffer == 'L') {
return true;
} else if (buffer == 'l') {
return false;
} else {
std::cerr << "Expected to receive 'l' or 'L' from device after toggling display, but got " << buffer << std::endl;
exit(1);
}
// restart IO thread
startIOThread();
}
void PowerSensor::IOThread() {
threadStarted.up();
unsigned int sensorNumber, marker = 0, sensorsRead = 0;
uint16_t level;
// wait until we can read values from the device
readLevelFromDevice(&sensorNumber, &level, &marker);
threadStarted.up();
while (readLevelFromDevice(&sensorNumber, &level, &marker)) {
std::unique_lock<std::mutex> lock(mutex);
Expand All @@ -329,7 +306,7 @@ Program Listing for File PowerSensor.cc
sensors[sensorNumber].updateLevel(level);
sensorsRead++;
if (sensorsRead >= numActiveSensors) {
if (sensorsRead >= MAX_SENSORS) {
sensorsRead = 0;
updateSensorPairs();
Expand Down
5 changes: 5 additions & 0 deletions _sources/api/unabridged_api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Variables

variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752.rst

.. toctree::
:maxdepth: 5

variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056.rst

.. toctree::
:maxdepth: 5

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _exhale_variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056:

Variable PowerSensor3::POWERSENSOR_VERSION
==========================================

- Defined in :ref:`file_host_include_PowerSensor.hpp`


Variable Documentation
----------------------


.. doxygenvariable:: PowerSensor3::POWERSENSOR_VERSION
2 changes: 1 addition & 1 deletion _static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.1.0',
VERSION: '1.3.0',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
15 changes: 2 additions & 13 deletions api/classPowerSensor3_1_1PowerSensor.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Class PowerSensor &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Class PowerSensor &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down Expand Up @@ -115,7 +115,7 @@ <h2>Class Documentation<a class="headerlink" href="#class-documentation" title="
<dd><p>Construct a new Power Sensor:: Power Sensor object. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>device</strong> – path to device, e.g. /dev/ttyACM1 </p>
<dd class="field-odd"><p><strong>device</strong> – path to device, e.g. /dev/ttyACM0 </p>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -175,17 +175,6 @@ <h2>Class Documentation<a class="headerlink" href="#class-documentation" title="
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N12PowerSensor311PowerSensor13toggleDisplayEv">
<span id="_CPPv3N12PowerSensor311PowerSensor13toggleDisplayEv"></span><span id="_CPPv2N12PowerSensor311PowerSensor13toggleDisplayEv"></span><span id="PowerSensor3::PowerSensor::toggleDisplay"></span><span class="target" id="classPowerSensor3_1_1PowerSensor_1a8780545212af538df9a0f1ca77ac7be5"></span><span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">toggleDisplay</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N12PowerSensor311PowerSensor13toggleDisplayEv" title="Permalink to this definition"></a><br /></dt>
<dd><p>Toggle device display on/off. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>New status of display: 1 for on, 0 for off </p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv4N12PowerSensor311PowerSensor20writeSensorsToEEPROMEv">
<span id="_CPPv3N12PowerSensor311PowerSensor20writeSensorsToEEPROMEv"></span><span id="_CPPv2N12PowerSensor311PowerSensor20writeSensorsToEEPROMEv"></span><span id="PowerSensor3::PowerSensor::writeSensorsToEEPROM"></span><span class="target" id="classPowerSensor3_1_1PowerSensor_1a362b2277c46832bf261478fc72cff53a"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">writeSensorsToEEPROM</span></span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv4N12PowerSensor311PowerSensor20writeSensorsToEEPROMEv" title="Permalink to this definition"></a><br /></dt>
Expand Down
2 changes: 1 addition & 1 deletion api/classPowerSensor3_1_1Semaphore.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Class Semaphore &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Class Semaphore &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
2 changes: 1 addition & 1 deletion api/class_view_hierarchy.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Class Hierarchy &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Class Hierarchy &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
2 changes: 1 addition & 1 deletion api/dir_host.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Directory host &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Directory host &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
2 changes: 1 addition & 1 deletion api/dir_host_include.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Directory include &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Directory include &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
2 changes: 1 addition & 1 deletion api/dir_host_src.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Directory src &mdash; PowerSensor 3 1.1.0 documentation</title>
<title>Directory src &mdash; PowerSensor 3 1.3.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/collapsible-lists/css/tree_view.css" type="text/css" />
Expand Down
Loading

0 comments on commit 405e381

Please sign in to comment.