Skip to content

Commit

Permalink
Added support for notes to Record class and record entry point.
Browse files Browse the repository at this point in the history
* Added user_data parameter to Record.open().
* Added "--note" option to record entry point.
  • Loading branch information
mliberty1 committed Oct 18, 2024
1 parent 3138138 commit ff5fd1d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
This file contains the list of changes made to the Joulescope driver.


## 1.6.0

2024 Oct 18

* Added support for notes to Record class and record entry point.
* Added user_data parameter to Record.open().
* Added "--note" option to record entry point.


## 1.5.6

2024 Sep 20
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else()
endif()

project(JOULESCOPE_DRIVER
VERSION 1.5.6
VERSION 1.6.0
LANGUAGES C)
SET(PROJECT_PREFIX JSDRV)
SET(VERSION_STRING "${PROJECT_VERSION}")
Expand Down
4 changes: 2 additions & 2 deletions include/jsdrv/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
* added. Any changes that break backwards compatibility should
* not adversely affect performance.
*/
#define JSDRV_VERSION_MINOR 5
#define JSDRV_VERSION_MINOR 6

/**
* @brief The Joulescope driver patch version.
*
* Changes in the patch version indicate bug fixes and improvements.
*/
#define JSDRV_VERSION_PATCH 6
#define JSDRV_VERSION_PATCH 0

/**
* \brief The maximum version string length.
Expand Down
2 changes: 1 addition & 1 deletion node_api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "joulescope_driver",
"version": "1.5.6",
"version": "1.6.0",
"description": "Interface with Joulescopes using node.js and Electron",
"keywords": [
"Joulescope",
Expand Down
8 changes: 7 additions & 1 deletion pyjoulescope_driver/entry_points/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def parser_config(p):
+ 'current, voltage, power, current_range, gpi[0], gpi[1], gpi[2], gpi[3], trigger_in. '
+ 'You can also use the short form i, v, p, r, 0, 1, 2, 3, T '
+ 'Defaults to current,voltage.')
p.add_argument('--note',
help='Add an arbitrary note to the JLS file. '
+ 'Provide a quoted string to handle spaces.')
p.add_argument('filename',
nargs='?',
default=time64.filename(),
Expand Down Expand Up @@ -93,7 +96,10 @@ def on_cmd(args):
if args.verbose:
print(f'Record to file: {args.filename}')
print('Start recording. Press CTRL-C to stop.')
wr.open(args.filename)
user_data = []
if args.note is not None:
user_data.append([0, args.note])
wr.open(args.filename, user_data=user_data)
t_stop = None if args.duration is None else time.time() + args.duration
try:
while t_stop is None or t_stop > time.time():
Expand Down
9 changes: 8 additions & 1 deletion pyjoulescope_driver/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,24 @@ def __init__(self, driver, device_path, signals=None, auto=None):
signal['utc'] = None
self._signals[f'{device_path}.{signal_name}'] = signal

def open(self, filename):
def open(self, filename, user_data=None):
"""Start the recording.
:param filename: The filename for the recording. Use
time64.filename to produce a filename from timestamp.
:param user_data: The list of additional user data
given as [chunk_meta, data] pairs.
Use chunk_meta 0 and a data string for notes
that display in the Joulescope UI.
:return: self.
"""
if self._wr is not None:
self.close()
self._data_map.clear()
self._wr = Writer(filename)
if user_data is not None:
for chunk_meta, data in user_data:
self._wr.user_data(chunk_meta, data)
for idx, device_path in enumerate(self._device_paths):
_, model, serial_number = device_path.split('/')
model = model.upper()
Expand Down
2 changes: 1 addition & 1 deletion pyjoulescope_driver/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.


__version__ = "1.5.6"
__version__ = "1.6.0"

__title__ = "pyjoulescope_driver"
__description__ = 'Joulescope™ driver'
Expand Down

0 comments on commit ff5fd1d

Please sign in to comment.