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 toggleExit();
void showRearCamBG(); void showRearCamBG();
void hideRearCamBG(); void hideRearCamBG();
void createDebuglog();
private: private:
Ui::MainWindow* ui_; Ui::MainWindow* ui_;
@ -109,6 +110,7 @@ private:
bool rearcamState = false; bool rearcamState = false;
bool dashCamRecording = 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::hideRearCam);
connect(ui_->pushButtonRearcamBack, &QPushButton::clicked, this, &MainWindow::cameraControlHide); connect(ui_->pushButtonRearcamBack, &QPushButton::clicked, this, &MainWindow::cameraControlHide);
connect(ui_->pushButtonSave, &QPushButton::clicked, this, &MainWindow::cameraSave); connect(ui_->pushButtonSave, &QPushButton::clicked, this, &MainWindow::cameraSave);
connect(ui_->systemDebugging, &QPushButton::clicked, this, &MainWindow::createDebuglog);
ui_->pushButtonCameraShow->show(); ui_->pushButtonCameraShow->show();
ui_->pushButtonCameraHide->hide(); ui_->pushButtonCameraHide->hide();
} else { } else {
@ -199,8 +200,14 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->pushButtonSave->hide(); ui_->pushButtonSave->hide();
ui_->pushButtonRearcam->hide(); ui_->pushButtonRearcam->hide();
ui_->pushButtonRearcamBack->hide(); ui_->pushButtonRearcamBack->hide();
ui_->systemConfigInProgress->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) { if (!this->wifiButtonForce) {
ui_->pushButtonWirelessConnection->hide(); ui_->pushButtonWirelessConnection->hide();
@ -448,8 +455,15 @@ void f1x::openauto::autoapp::ui::MainWindow::hideRearCamBG()
ui_->pushButtonRearcamBack->hide(); ui_->pushButtonRearcamBack->hide();
} }
void f1x::openauto::autoapp::ui::MainWindow::createDebuglog()
{
system("/usr/local/bin/crankshaft debuglog &");
}
void f1x::openauto::autoapp::ui::MainWindow::showTime() void f1x::openauto::autoapp::ui::MainWindow::showTime()
{ {
using namespace std::this_thread; // sleep_for
using namespace std::chrono; // milliseconds
QTime time=QTime::currentTime(); QTime time=QTime::currentTime();
QString time_text=time.toString("hh : mm : ss"); 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"); 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) { if (ui_->systemConfigInProgress->isVisible() == false) {
ui_->systemConfigInProgress->setText("System config in progress - please wait ..."); if (configInProgressFile.exists()) {
ui_->systemConfigInProgress->show(); 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 { } else {
if (ui_->systemConfigInProgress->isVisible() == true) { if (ui_->systemConfigInProgress->isVisible() == true) {
ui_->systemConfigInProgress->hide(); 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); ui_->Digital_clock->setText(time_text);
using namespace std::this_thread; // sleep_for
using namespace std::chrono; // milliseconds
sleep_for(milliseconds(10)); sleep_for(milliseconds(10));
/**if (configuration_->showClock()) { /**if (configuration_->showClock()) {

View File

@ -171,6 +171,12 @@ void SettingsWindow::onSave()
params.append("0"); params.append("0");
} }
params.append("#"); 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()); system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str());
this->close(); this->close();
} }
@ -520,10 +526,18 @@ void SettingsWindow::loadSystemValues()
// set custom brightness command // set custom brightness command
if (getparams[26] == "1") { if (getparams[26] == "1") {
ui_->checkBoxCustomBrightnessCommand->setChecked(true); ui_->labelCustomBrightnessCommand->setText("Enabled");
} else { } 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"> <widget class="QLabel" name="systemConfigInProgress">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>200</x> <x>175</x>
<y>368</y> <y>368</y>
<width>400</width> <width>450</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>
@ -672,6 +672,59 @@
<set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set> <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
</property> </property>
</widget> </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>
</widget> </widget>
<tabstops> <tabstops>

View File

@ -2726,33 +2726,72 @@ subcontrol-position: center left;
<rect> <rect>
<x>0</x> <x>0</x>
<y>320</y> <y>320</y>
<width>616</width> <width>300</width>
<height>91</height> <height>61</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
<string>Custom Brightness Command</string> <string>Custom Brightness Command</string>
</property> </property>
<widget class="QCheckBox" name="checkBoxCustomBrightnessCommand"> <widget class="QLabel" name="labelCustomBrightnessCommand">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>30</y> <y>30</y>
<width>281</width> <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> <height>23</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Custom Birghtness Command activated</string> <string>Enabled</string>
</property> </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> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labelCustomBrightnessCommandInfoIcon"> <widget class="QLabel" name="labelDebugmodeInfoIcon">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>10</x>
<y>56</y> <y>56</y>
<width>21</width> <width>21</width>
<height>31</height> <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> <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> </property>
</widget> </widget>
<widget class="QLabel" name="labelCustomBrightnessCommandNote"> <widget class="QLabel" name="labelDebugmodeNote">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>60</x> <x>40</x>
<y>60</y> <y>60</y>
<width>551</width> <width>251</width>
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
@ -2777,7 +2816,7 @@ subcontrol-position: center left;
</font> </font>
</property> </property>
<property name="text"> <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>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>