Added start of UI elements for I2C

This commit is contained in:
Chris Esposito 2018-09-03 06:11:53 +10:00
parent ba4644bc35
commit c96dd98c0f
5 changed files with 57 additions and 51 deletions

View File

@ -1452,5 +1452,9 @@ void isoDriver::disableFileMode(){
if (delay < 0) delay = 0;
}
void isoDriver::setSerialType(unsigned char type)
{
serialType = type;
qDebug() << "Serial Type changed to" << serialType;
}

View File

@ -47,6 +47,7 @@ public:
void setAxes(QCustomPlot *newAxes);
double meanVoltageLast(double seconds, unsigned char channel, int TOP);
void loadFileBuffer(QFile *fileToLoad);
void setSerialType(unsigned char type);
//DAQ
bool fileModeEnabled = false;
double daq_maxWindowSize;
@ -111,6 +112,8 @@ private:
enum multimeterType_enum {V = 0, I = 1, R = 2, C = 3};
multimeterType_enum multimeterType = V;
double seriesResistance = 0;
// Logic Analyser
unsigned char serialType = 0;
//Generic Vars
double windowAtPause = 0.01;
QTimer* isoTimer = NULL, *slowTimer = NULL, *fileTimer = NULL;

View File

@ -148,7 +148,6 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->controller_iso, SIGNAL(sendVRMS_CH2(double)), ui->voltageInfoRmsDisplay_CH2, SLOT(display(double)));
connect(ui->controller_iso, SIGNAL(mainWindowPleaseDisableSerial(int)), this, SLOT(serialEmergencyDisable(int)));
connect(ui->serialDecodingModeSelect_CH1, SIGNAL(currentIndexChanged(int)), this, SLOT(checkForI2C(int)));
connect(ui->controller_iso->driver, SIGNAL(signalFirmwareFlash(void)), ui->deviceConnected, SLOT(flashingFirmware(void)));
connect(ui->controller_iso->internalBuffer375_CH1, SIGNAL(fileIOinternalDisable()), this, SLOT(fileLimitReached_CH1()));
@ -315,6 +314,10 @@ void MainWindow::menuSetup(){
fpsGroup->addAction(ui->action10FPS);
fpsGroup->addAction(ui->action5FPS);
serialProtocolGroup = new QActionGroup(this);
serialProtocolGroup->addAction(ui->actionSerial);
serialProtocolGroup->addAction(ui->actionI2C);
connect(ui->actionAutoV, SIGNAL(toggled(bool)), ui->controller_iso, SLOT(setAutoMultimeterV(bool)));
connect(ui->actionV, SIGNAL(toggled(bool)), ui->controller_iso, SLOT(setForceVolts(bool)));
@ -1964,18 +1967,6 @@ void MainWindow::serialEmergencyDisable(int channel){
}
//This is a slot that intercepts a signal from the serial decoding CH1 checkbox.
//It changes the mode to ensure I2C can work.
//Both channels are necessary; SDA and SCL.
void MainWindow::checkForI2C(int value){
if(value==2){
ui->scopeGroup_CH1->setChecked(false);
ui->scopeGroup_CH2->setChecked(false);
ui->multimeterGroup->setChecked(false);
}
return;
}
void MainWindow::on_actionFirmware_Recovery_triggered()
{
qDebug() << "on_actionFirmware_Recovery_triggered";
@ -2197,3 +2188,13 @@ void MainWindow::calibrate_psu_stage3()
qDebug() << "PSU Calibration complete! Offset =" << psu_voltage_calibration_offset;
}
void MainWindow::on_actionSerial_triggered(bool checked)
{
ui->controller_iso->setSerialType(0);
}
void MainWindow::on_actionI2C_triggered(bool checked)
{
ui->controller_iso->setSerialType(1);
}

View File

@ -160,7 +160,6 @@ private slots:
void serialEmergencyDisable(int channel);
void checkForI2C(int value);
void on_actionFirmware_Recovery_triggered();
void on_actionShow_Debug_Console_triggered();
@ -190,6 +189,10 @@ private slots:
void calibrate_psu_stage3();
void on_actionSerial_triggered(bool checked);
void on_actionI2C_triggered(bool checked);
private:
//Generic Vars
Ui::MainWindow *ui;
@ -227,6 +230,7 @@ private:
QActionGroup *uartBaudGroup_CH2;
QActionGroup *fpsGroup;
QActionGroup *connectionTypeGroup;
QActionGroup *serialProtocolGroup;
QShortcut *shortcut_cycleBaudRate_CH1;
QShortcut *shortcut_cycleBaudRateBackwards_CH1;
QShortcut *shortcut_cycleBaudRate_CH2;

View File

@ -1148,25 +1148,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="serialDecodingModeSelect_CH1">
<item>
<property name="text">
<string>UART</string>
</property>
</item>
<item>
<property name="text">
<string>SPI</string>
</property>
</item>
<item>
<property name="text">
<string>I2C</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@ -1218,20 +1199,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="serialDecodingModeSelect_CH2">
<item>
<property name="text">
<string>UART</string>
</property>
</item>
<item>
<property name="text">
<string>SPI</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@ -1341,7 +1308,7 @@
<x>0</x>
<y>0</y>
<width>1440</width>
<height>26</height>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -1445,8 +1412,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>159</width>
<height>126</height>
<width>170</width>
<height>115</height>
</rect>
</property>
<property name="title">
@ -1564,6 +1531,14 @@
<addaction name="menuData_Bits_2"/>
<addaction name="menuParity_Bit_2"/>
</widget>
<widget class="QMenu" name="menuProtocol">
<property name="title">
<string>Protocol</string>
</property>
<addaction name="actionSerial"/>
<addaction name="actionI2C"/>
</widget>
<addaction name="menuProtocol"/>
<addaction name="menuUART_1"/>
<addaction name="menuUART_2"/>
</widget>
@ -2302,6 +2277,25 @@
<string>Mean Point from GND</string>
</property>
</action>
<action name="actionSerial">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Serial</string>
</property>
</action>
<action name="actionI2C">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>I2C</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>