Compare commits

..

3 Commits

Author SHA1 Message Date
Vasily Davydov
ed461524af root: add script for reading logs 2023-07-07 17:03:57 +03:00
Vasily Davydov
486b4a40b2 main: working version 0.2 2023-07-07 17:03:36 +03:00
Vasily Davydov
9be6c99e2c
Merge pull request #68 from vas-dav/pinmap-hdr
threadcommon: [#67] common pinmap header
2023-07-07 15:22:14 +03:00
5 changed files with 34 additions and 6 deletions

28
read_logs.py Normal file
View 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()

View File

@ -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

View File

@ -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)

View File

@ -24,11 +24,11 @@ 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} };
}; };
void thread_rotary(void* pvParams); void thread_rotary(void* pvParams);

View File

@ -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())