Compare commits
3 Commits
pinmap-hdr
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed461524af | ||
|
|
486b4a40b2 | ||
|
|
9be6c99e2c |
28
read_logs.py
Normal file
28
read_logs.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import serial
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
# Configure serial port settings
|
||||||
|
port = '/dev/cu.usbmodemNRAQBQER2' # Replace with your specific serial port
|
||||||
|
baud_rate = 115200 # Replace with the appropriate baud rate
|
||||||
|
timeout = 1 # Specify the timeout for reading from the serial port
|
||||||
|
|
||||||
|
# Open the serial port
|
||||||
|
ser = serial.Serial(port, baud_rate, timeout=timeout)
|
||||||
|
|
||||||
|
# Generate the filename based on current date and time
|
||||||
|
now = datetime.now()
|
||||||
|
date_time = now.strftime("%Y-%m-%d_%H-%M")
|
||||||
|
filename = f"{date_time}_SHOH.txt"
|
||||||
|
|
||||||
|
# Open a file to write the logs
|
||||||
|
with open(filename, 'w') as file:
|
||||||
|
# Read and write the logs from the serial port
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode().strip()
|
||||||
|
if line:
|
||||||
|
file.write(line + '\n')
|
||||||
|
print(line) # Optional: Print the logs to the console as well
|
||||||
|
|
||||||
|
# Close the serial port when done
|
||||||
|
ser.close()
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ extern QueueHandle_t logging_queue;
|
|||||||
/* ================= Settings ================== */
|
/* ================= Settings ================== */
|
||||||
#define LOG_COLORED_OUTPUT
|
#define LOG_COLORED_OUTPUT
|
||||||
#define HIGH_PRIORITY_DEBUG
|
#define HIGH_PRIORITY_DEBUG
|
||||||
#define LOG_DEBUG_MESSAGES 1
|
#define LOG_DEBUG_MESSAGES 0
|
||||||
/* ================= Settings ================== */
|
/* ================= Settings ================== */
|
||||||
|
|
||||||
// internal debug defines
|
// internal debug defines
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void Master::HandleEventType(Event* e)
|
|||||||
//Comes from rotary, goes to manager
|
//Comes from rotary, goes to manager
|
||||||
send = _qm->send<Event>(ThreadCommon::QueueManager::manager_event_master, e, 0);
|
send = _qm->send<Event>(ThreadCommon::QueueManager::manager_event_master, e, 0);
|
||||||
//LOG_WARNING("Timestamp: %zus, Clock: %zu, Chip freq: %zu", LPC_SCT1->COUNT_U / Chip_Clock_GetMainClockRate(), LPC_SCT1->COUNT_U, Chip_Clock_GetMainClockRate());
|
//LOG_WARNING("Timestamp: %zus, Clock: %zu, Chip freq: %zu", LPC_SCT1->COUNT_U / Chip_Clock_GetMainClockRate(), LPC_SCT1->COUNT_U, Chip_Clock_GetMainClockRate());
|
||||||
if (send) LOG_DEBUG("Rotary: %s has been forwarded to manager", rotary_direction[rd]);
|
if (send) LOG_INFO("Rotary: %s has been forwarded to manager", rotary_direction[rd]);
|
||||||
break;
|
break;
|
||||||
case Event::InternalTemp:
|
case Event::InternalTemp:
|
||||||
// TODO remove (deprecated)
|
// TODO remove (deprecated)
|
||||||
|
|||||||
@ -24,10 +24,10 @@ private:
|
|||||||
ThreadCommon::PIN_ROTARY_SIG_A,
|
ThreadCommon::PIN_ROTARY_SIG_A,
|
||||||
true, true, false, true, PIN_INT0_IRQn},
|
true, true, false, true, PIN_INT0_IRQn},
|
||||||
{ ThreadCommon::PORT_ROTARY_SIG_B,
|
{ ThreadCommon::PORT_ROTARY_SIG_B,
|
||||||
ThreadCommon::PIN_ROTARY_SIG_A,
|
ThreadCommon::PIN_ROTARY_SIG_B,
|
||||||
true, true, false},
|
true, true, false},
|
||||||
{ ThreadCommon::PORT_ROTARY_PRESS,
|
{ ThreadCommon::PORT_ROTARY_PRESS,
|
||||||
ThreadCommon::PIN_ROTARY_SIG_A,
|
ThreadCommon::PIN_ROTARY_PRESS,
|
||||||
true, true, false, true, PIN_INT1_IRQn} };
|
true, true, false, true, PIN_INT1_IRQn} };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ void Temperature::taskFunction()
|
|||||||
SensorTempSHT20 ext_temp_sensor(this->_pi2c);
|
SensorTempSHT20 ext_temp_sensor(this->_pi2c);
|
||||||
Event t (Event::ExternalTemp, -128);
|
Event t (Event::ExternalTemp, -128);
|
||||||
int8_t temp_value = -128;
|
int8_t temp_value = -128;
|
||||||
_qm->send<Event>(ThreadCommon::QueueManager::master_event_all, &t, 0);
|
while(ext_temp_sensor.is_up() != true);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (ext_temp_sensor.is_up())
|
if (ext_temp_sensor.is_up())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user