Skip to content
Snippets Groups Projects
Commit 8fc84ee5 authored by Adrian Tüscher's avatar Adrian Tüscher
Browse files

corrected sample get commands

extended documentation of data_stream commands
corrected/extended documentation of start_factory_bootloader commands

added set_data_stream-function in serial interface
added data_cursor_rewind action-function in serial interface
added start_factory_bootloader action-function in serial interface
parent ca52706a
No related branches found
No related tags found
No related merge requests found
Pipeline #238424 passed
......@@ -153,11 +153,11 @@ See :ref:`sample_count <sample-count>`.
RTC_Date(yyyy.mm.dd hh:mm:ss.fff);
<*Measurement_Auto*>;Battery_Voltage(V);
BME_Temperature(C);BME_Pressure(Pa);BME_Humidity(%);ADC_IN8(V);ADC_IN9(V)
BME_Temperature(C);BME_Pressure(Pa);BME_Humidity(%);ADC_IN8(V);ADC_IN9(V);ADC_IN10(V);ADC_IN11(V)
<*Measurement_Auto*>: {'0': manual measurement, '1': RTC time based measurement}
example: '2021.02.24;15:39:38.183;0;0.602;27.477;97851.906;60.512;3.485;0.000'
example: '2021.03.22 09:16:22.199;0;7.132812;23.437500;96792.335937;36.806640;3.480591;0.000000;0.000000;0.000000'
'''),
rtc_time=Command('RTG',
doc='''
......@@ -273,6 +273,9 @@ Name cannot be empty
data_stream=Command('DSS', 'active', 1,
doc='''
activate/deactivate fast data streaming over serial port {'0': disable, '1': enable}
.. note::
The streamed data are not stored in the FLASH of the datalogger. They are just sent out once over the virtual COM-Port.
'''),
auto_sampling=Command('ASS', 'active', 1,
doc='''
......@@ -330,15 +333,15 @@ Trigger a manual measurement over the serial interface. The measurement is logge
with the flag indicating automatic measurement set to 0.
'''),
# This will be removed from the serial UI
start_factory_bootloader=Command('UBA',
start_factory_bootloader=Command('UBA', 'key', 4,
doc='''
.. note::
This command does not return ``ACK`` on success
Exit the user application and jumps to the factory integrated USB-Bootloader.
Exit the user application and jumps to the factory integrated USB-Bootloader (DFU USB Device).
Just a small key is needed to successful enter the bootloader (4
characters) {hexadecimal: ``12345678``}.
characters) {hexadecimal: ``0x78345612``}.
A firmware update can be executed with the STM32CubeProgrammer
application (details see in user manual)
......
......@@ -528,6 +528,38 @@ def set_device_name(name):
if 'nak' in answer.lower():
raise RuntimeError(f"Failed to set device name {name}")
def set_data_stream(stream=False):
""" Enable/Disable data streaming over serial interface.
If enabled, one measurement after another is executed and values are streamed over serial interface.
Data-Output is the same as MVG-Command is executed.
Parameters
----------
stream: :class:`bool`, optional (default False)
False to disable the data streaming. True to enable it.
If not given, it defaults to False, i.e. the data streaming is disabled.
Raises
------
RuntimeError
If command fails: logger returns ``NAK``
"""
cmd = SetterDict['data_stream'](streaming='1' if stream else '0')
answer = run_command(cmd).data
if 'nak' in answer.lower():
raise RuntimeError("Failed to set data stream enable/disable")
def enable_data_stream():
""" Alias for :func:`~.set_data_stream` with True argument"""
set_data_stream(True)
def disable_data_stream():
""" Alias for :func:`~.set_data_stream` with False argument"""
set_data_stream(False)
def set_sampling_interval(interval):
""" Set sampling interval over the serial port
......@@ -752,6 +784,33 @@ delete_samples = data_clear
""" Alias for :func:`~.data_clear`. """
def data_cursor_rewind():
""" Rewind the data readout cursor, so on next data export all stored data are
exported again, not only the not already exported.
Raises
------
RuntimeError
If command fails: logger returns ``NAK``
"""
answer = run_command(ActionDict['data_cursor_rewind']()).data
if 'nak' in answer.lower():
raise RuntimeError(f"Failed to rewind data cursors")
def start_factory_bootloader():
""" Exit the user application and jumps to the factory integrated USB-Bootloader (DFU USB Device).
Raises
------
RuntimeError
If command fails: logger returns ``NAK``
"""
answer = run_command(ActionDict['start_factory_bootloader'](key=bytes.fromhex('78345612').decode('utf-8'))).data
if 'nak' in answer.lower():
raise RuntimeError(f"Failed to start factory USB DFU bootloader")
def get_data_to_pandas(*, from_sample=0, resample=True):
""" Get series of smaples and return a :class:`pandas.DataFrame`.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment