Heljarinnar breytingar til þess að laga nokkra hluti í part 1.
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
#include "operational_state.h"
|
||||
#include "motor_controller.h"
|
||||
|
||||
//#include <Arduino.h>
|
||||
|
||||
#include <zephyr/sys/printk.h>
|
||||
|
||||
|
||||
void OperationalState::enter()
|
||||
{
|
||||
//Serial.println("State: Operational");
|
||||
printk("State: Operational\n");
|
||||
|
||||
context->reset_controller();
|
||||
@@ -18,25 +14,15 @@ void OperationalState::enter()
|
||||
sample_count = 0;
|
||||
|
||||
#if LOG_CSV
|
||||
//Serial.println("time_ms,ref_rpm,actual_rpm,pwm");
|
||||
printk("time_ms,ref_rpm,actual_rpm,pwm\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Part 1
|
||||
|
||||
//void OperationalState::update()
|
||||
//{
|
||||
// context->run_speed_controller();
|
||||
//}
|
||||
|
||||
// Part 2
|
||||
|
||||
void OperationalState::update()
|
||||
{
|
||||
if (context->fault_active())
|
||||
{
|
||||
//Serial.println("Fault detected");
|
||||
printk("Fault detected\n");
|
||||
|
||||
context->to_stopped();
|
||||
@@ -50,13 +36,6 @@ void OperationalState::update()
|
||||
|
||||
#if LOG_CSV
|
||||
// 4 ms á milli sýna, tíminn byrjar á 0 við hverja innkomu í Operational
|
||||
// Serial.print(sample_count * 4UL);
|
||||
// Serial.print(',');
|
||||
// Serial.print(context->get_reference_rpm(), 1);
|
||||
// Serial.print(',');
|
||||
// Serial.print(context->get_actual_rpm(), 2);
|
||||
// Serial.print(',');
|
||||
// Serial.println(context->get_pwm(), 1);
|
||||
printk("%u,%.1f,%.2f,%.1f\n",
|
||||
static_cast<unsigned int>(sample_count * 4U),
|
||||
context->get_reference_rpm(),
|
||||
@@ -71,7 +50,6 @@ void OperationalState::command(char c)
|
||||
{
|
||||
if (c == 'r' || c == 'R')
|
||||
{
|
||||
//Serial.println("Command: reset");
|
||||
printk("Command: reset\n");
|
||||
|
||||
context->to_initialization();
|
||||
@@ -79,7 +57,6 @@ void OperationalState::command(char c)
|
||||
|
||||
else if (c == 'p' || c == 'P')
|
||||
{
|
||||
//Serial.println("Command: set pre-operational");
|
||||
printk("Command: set pre-operational\n");
|
||||
|
||||
context->to_pre_operational();
|
||||
@@ -92,4 +69,4 @@ void OperationalState::exit()
|
||||
context->stop_motor();
|
||||
|
||||
context->led_off();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user