Init debug mode via gui

This commit is contained in:
hawkeyexp 2018-07-25 20:39:35 +02:00
parent a1472a2546
commit a64f3341f2
5 changed files with 155 additions and 22 deletions

View File

@ -75,6 +75,7 @@ private slots:
void toggleExit();
void showRearCamBG();
void hideRearCamBG();
void createDebuglog();
private:
Ui::MainWindow* ui_;
@ -109,6 +110,7 @@ private:
bool rearcamState = false;
bool dashCamRecording = false;
bool systemDebugmode = false;
};
}

View File

@ -172,6 +172,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
connect(ui_->pushButtonRearcamBack, &QPushButton::clicked, this, &MainWindow::hideRearCam);
connect(ui_->pushButtonRearcamBack, &QPushButton::clicked, this, &MainWindow::cameraControlHide);
connect(ui_->pushButtonSave, &QPushButton::clicked, this, &MainWindow::cameraSave);
connect(ui_->systemDebugging, &QPushButton::clicked, this, &MainWindow::createDebuglog);
ui_->pushButtonCameraShow->show();
ui_->pushButtonCameraHide->hide();
} else {
@ -199,8 +200,14 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->pushButtonSave->hide();
ui_->pushButtonRearcam->hide();
ui_->pushButtonRearcamBack->hide();
ui_->systemConfigInProgress->hide();
ui_->systemDebugging->hide();
QFileInfo DebugmodeFile("/tmp/usb_debug_mode");
if (DebugmodeFile.exists()) {
ui_->systemDebugging->show();
this->systemDebugmode = true;
}
if (!this->wifiButtonForce) {
ui_->pushButtonWirelessConnection->hide();
@ -448,8 +455,15 @@ void f1x::openauto::autoapp::ui::MainWindow::hideRearCamBG()
ui_->pushButtonRearcamBack->hide();
}
void f1x::openauto::autoapp::ui::MainWindow::createDebuglog()
{
system("/usr/local/bin/crankshaft debuglog &");
}
void f1x::openauto::autoapp::ui::MainWindow::showTime()
{
using namespace std::this_thread; // sleep_for
using namespace std::chrono; // milliseconds
QTime time=QTime::currentTime();
QString time_text=time.toString("hh : mm : ss");
@ -470,14 +484,28 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
}
QFileInfo configInProgressFile("/tmp/config_in_progress");
if (configInProgressFile.exists()) {
QFileInfo debugInProgressFile("/tmp/debug_in_progress");
if (configInProgressFile.exists() || debugInProgressFile.exists()) {
if (ui_->systemConfigInProgress->isVisible() == false) {
ui_->systemConfigInProgress->setText("System config in progress - please wait ...");
ui_->systemConfigInProgress->show();
if (configInProgressFile.exists()) {
ui_->systemConfigInProgress->setText("System config in progress - please wait ...");
ui_->pushButtonSettings->hide();
ui_->systemConfigInProgress->show();
}
if (debugInProgressFile.exists()) {
ui_->systemConfigInProgress->setText("Creating debug.zip on /boot - please wait ...");
ui_->systemDebugging->hide();
ui_->systemConfigInProgress->show();
}
}
} else {
if (ui_->systemConfigInProgress->isVisible() == true) {
ui_->systemConfigInProgress->hide();
ui_->pushButtonSettings->show();
if (this->systemDebugmode) {
ui_->systemDebugging->show();
}
}
}
@ -537,9 +565,6 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
}
ui_->Digital_clock->setText(time_text);
using namespace std::this_thread; // sleep_for
using namespace std::chrono; // milliseconds
sleep_for(milliseconds(10));
/**if (configuration_->showClock()) {

View File

@ -171,6 +171,12 @@ void SettingsWindow::onSave()
params.append("0");
}
params.append("#");
if (ui_->radioButtonDebugmodeEnabled->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append("#");
system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str());
this->close();
}
@ -520,10 +526,18 @@ void SettingsWindow::loadSystemValues()
// set custom brightness command
if (getparams[26] == "1") {
ui_->checkBoxCustomBrightnessCommand->setChecked(true);
ui_->labelCustomBrightnessCommand->setText("Enabled");
} else {
ui_->checkBoxCustomBrightnessCommand->setChecked(false);
ui_->labelCustomBrightnessCommand->setText("Disabled");
}
// set debug mode
if (getparams[27] == "1") {
ui_->radioButtonDebugmodeEnabled->setChecked(true);
} else {
ui_->radioButtonDebugmodeDisabled->setChecked(true);
}
}
}

View File

@ -644,9 +644,9 @@
<widget class="QLabel" name="systemConfigInProgress">
<property name="geometry">
<rect>
<x>200</x>
<x>175</x>
<y>368</y>
<width>400</width>
<width>450</width>
<height>24</height>
</rect>
</property>
@ -672,6 +672,59 @@
<set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
</property>
</widget>
<widget class="QPushButton" name="systemDebugging">
<property name="geometry">
<rect>
<x>650</x>
<y>368</y>
<width>140</width>
<height>24</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Roboto</family>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton { background: grey; border: none; }
QPushButton:pressed { background: orange; border: none; }</string>
</property>
<property name="text">
<string>Create Log</string>
</property>
<property name="iconSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="autoRepeat">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</widget>
</widget>
<tabstops>

View File

@ -2726,33 +2726,72 @@ subcontrol-position: center left;
<rect>
<x>0</x>
<y>320</y>
<width>616</width>
<height>91</height>
<width>300</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>Custom Brightness Command</string>
</property>
<widget class="QCheckBox" name="checkBoxCustomBrightnessCommand">
<widget class="QLabel" name="labelCustomBrightnessCommand">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>281</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>disabled</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxDebugmode">
<property name="geometry">
<rect>
<x>325</x>
<y>320</y>
<width>291</width>
<height>91</height>
</rect>
</property>
<property name="title">
<string>Debugmode</string>
</property>
<widget class="QRadioButton" name="radioButtonDebugmodeEnabled">
<property name="geometry">
<rect>
<x>120</x>
<y>30</y>
<width>120</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Custom Birghtness Command activated</string>
<string>Enabled</string>
</property>
<property name="checkable">
</widget>
<widget class="QRadioButton" name="radioButtonDebugmodeDisabled">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Disabled</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labelCustomBrightnessCommandInfoIcon">
<widget class="QLabel" name="labelDebugmodeInfoIcon">
<property name="geometry">
<rect>
<x>30</x>
<x>10</x>
<y>56</y>
<width>21</width>
<height>31</height>
@ -2762,12 +2801,12 @@ subcontrol-position: center left;
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelCustomBrightnessCommandNote">
<widget class="QLabel" name="labelDebugmodeNote">
<property name="geometry">
<rect>
<x>60</x>
<x>40</x>
<y>60</y>
<width>551</width>
<width>251</width>
<height>23</height>
</rect>
</property>
@ -2777,7 +2816,7 @@ subcontrol-position: center left;
</font>
</property>
<property name="text">
<string>Just an information - not checkable! - Can be activated in crankshaft_env.sh!</string>
<string>Debud Mode excludes dev mode!</string>
</property>
<property name="wordWrap">
<bool>true</bool>