Skip to content
Snippets Groups Projects
Commit 07925fde authored by Elisabetta Pianori's avatar Elisabetta Pianori
Browse files

Merge branch 'dantrim_py_incrdebug' into 'devel'

Expose Logger's `incrDebug` in the Python bindings

See merge request !207
parents 651d463a ebe389a3
Branches
Tags v5.2.1
6 merge requests!308Bring main and devel back in sync,!300playing with fixing divergence between devel and main,!287Updates for Julabo Chiller,!285Julabo Chiller Added with Fixed Pipeline Compatibility,!269Merge devel into main: largest change is code formatting checker and enforcement in CI,!207Expose Logger's `incrDebug` in the Python bindings
Pipeline #2489642 failed
import labRemote
from labRemote import chiller, com
import time
......@@ -51,6 +52,12 @@ if __name__ == "__main__" :
parser.add_argument("-t", "--temperature", default = 15, type = float,
help = "Set the target temperature of the chiller (degrees Celsius)"
)
parser.add_argument("-d", "--debug", action = "count", default = 0,
help = "Enable more verbose printout"
)
args = parser.parse_args()
for _ in range(args.debug)
labRemote.incrDebug()
chiller_example(args.port, args.baud, args.temperature)
import labRemote
from labRemote import ps, ec
from argparse import ArgumentParser
......@@ -71,8 +72,14 @@ if __name__ == "__main__":
parser.add_argument("channel-name", type = str,
help = "Powersupply channel to control"
)
parser.add_argument("-d", "--debug", action = "count", default = 0,
help = "Enable more verbose printout"
)
args = parser.parse_args()
for _ in range(args.debug) :
labRemote.incrDebug()
config = Path(args.config_file)
if not config.exists() or not config.is_file() :
logger.error(f"Provided configuration file \"{args.config_file}\" could not be found")
......
import labRemote
from labRemote import ec
from datetime import datetime
......@@ -52,8 +53,14 @@ if __name__ == "__main__":
parser.add_argument("stream-name", type = str,
help = "Name of the datastream to use"
)
parser.add_argument("-d", "--debug", action = "count", default = 0,
help = "Enable more verbose printout"
)
args = parser.parse_args()
for _ in range(args.debug) :
labRemote.incrDebug()
config_path = Path(args.config_file)
if not config_path.exists() or not config_path.is_file() :
logger.error(f"Provided configuration file \"{args.config_file}\" could not be found")
......
import labRemote
from labRemote import com
from argparse import ArgumentParser
......@@ -87,6 +88,12 @@ if __name__ == "__main__" :
parser.add_argument("-b", "--baud", default = 9600, type = int,
help = "Baud rate for USB communication with the connected Arduino device"
)
parser.add_argument("-d", "--debug", action = "count", default = 0,
help = "Enable more verbose printout messages from labRemote"
)
args = parser.parse_args()
for _ in range(args.debug) :
args.incrDebug()
devcomuino_example(args.port, args.baud)
import labRemote
from labRemote import devcom, com
import time
......@@ -71,5 +72,13 @@ if __name__ == "__main__":
parser.add_argument("pin", type = str,
help = "Pin on the sensor to sample from"
)
parser.add_argument("-d", "--debug", action = "count", default = 0,
help = "Enable more verbose printout from labRemote"
)
args = parser.parse_args()
for _ in range(args.debug) :
labRemote.incrDebug()
ntc_example(args.device_port, args.pin)
import labRemote
from labRemote import devcom
from argparse import ArgumentParser
......@@ -13,7 +14,13 @@ def temp_hum_monitor_example() :
if __name__ == "__main__" :
parser = ArgumentParser(description = "Example of performing continous monitoring of several climate sensors, using data streams")
parser.parse_args()
parser.add_argument("-d", "--debug", action = "count", default = 0,
help = "Enable more verbose printout of labRemote messages"
)
args = parser.parse_args()
for _ in range(args.debug) :
labRemote.incrDebug()
##
## first check that the FTDI support has been enabled in the current labRemote build
......
from ._labRemote import com, ec, ps, datasink, devcom, chiller
__all__ = ['com', 'ec', 'ps', 'datasink', 'devcom', 'chiller']
from ._labRemote import incrDebug
__all__ = ['com', 'ec', 'ps', 'datasink', 'devcom', 'chiller', 'incrDebug']
#include "Logger.h"
#include <pybind11/pybind11.h>
namespace py = pybind11;
......@@ -27,4 +29,6 @@ PYBIND11_MODULE(_labRemote, m) {
py::module chiller = m.def_submodule("chiller");
register_chiller(chiller);
m.def("incrDebug", &logIt::incrDebug);
}
......@@ -181,6 +181,7 @@ if __name__ == "__main__":
if args.debug:
logger.setLevel(logging.DEBUG)
labRemote.incrDebug()
logging.debug("Debug mode is on")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment