mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	LimeSDR: report GPIO pins values in the GUI
This commit is contained in:
		
							parent
							
								
									5319eac2ff
								
							
						
					
					
						commit
						83b66eb6f1
					
				| @ -103,18 +103,21 @@ public: | ||||
| 
 | ||||
|     public: | ||||
|         float getTemperature() const { return m_temperature; } | ||||
|         uint8_t getGPIOPins() const { return m_gpioPins; } | ||||
| 
 | ||||
|         static MsgReportDeviceInfo* create(float temperature) | ||||
|         static MsgReportDeviceInfo* create(float temperature, uint8_t gpioPins) | ||||
|         { | ||||
|             return new MsgReportDeviceInfo(temperature); | ||||
|             return new MsgReportDeviceInfo(temperature, gpioPins); | ||||
|         } | ||||
| 
 | ||||
|     private: | ||||
|         float    m_temperature; | ||||
|         uint8_t  m_gpioPins; | ||||
| 
 | ||||
|         MsgReportDeviceInfo(float temperature) : | ||||
|         MsgReportDeviceInfo(float temperature, uint8_t gpioPins) : | ||||
|             Message(), | ||||
|             m_temperature(temperature) | ||||
|             m_temperature(temperature), | ||||
|             m_gpioPins(gpioPins) | ||||
|         { } | ||||
|     }; | ||||
| 
 | ||||
|  | ||||
| @ -655,19 +655,20 @@ bool LimeSDROutput::handleMessage(const Message& message) | ||||
|     else if (MsgGetDeviceInfo::match(message)) | ||||
|     { | ||||
|         double temp = 0.0; | ||||
|         uint8_t gpioPins = 0; | ||||
| 
 | ||||
|         if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) == 0)) | ||||
|         { | ||||
|             //qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: temperature: %f", temp);
 | ||||
|         if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) != 0)) { | ||||
|             qWarning("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); | ||||
| 
 | ||||
|         if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GPIORead(m_deviceShared.m_deviceParams->getDevice(), &gpioPins, 1) != 0)) { | ||||
|             qWarning("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get GPIO pins values"); | ||||
|         } | ||||
| 
 | ||||
|         // send to oneself
 | ||||
|         if (getMessageQueueToGUI()) { | ||||
|             DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); | ||||
|         if (getMessageQueueToGUI())  | ||||
|         { | ||||
|             DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins); | ||||
|             getMessageQueueToGUI()->push(report); | ||||
|         } | ||||
| 
 | ||||
| @ -679,7 +680,7 @@ bool LimeSDROutput::handleMessage(const Message& message) | ||||
|         { | ||||
|             if ((*itSource)->getSampleSourceGUIMessageQueue()) | ||||
|             { | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins); | ||||
|                 (*itSource)->getSampleSourceGUIMessageQueue()->push(report); | ||||
|             } | ||||
|         } | ||||
| @ -692,7 +693,7 @@ bool LimeSDROutput::handleMessage(const Message& message) | ||||
|         { | ||||
|             if ((*itSink)->getSampleSinkGUIMessageQueue()) | ||||
|             { | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins); | ||||
|                 (*itSink)->getSampleSinkGUIMessageQueue()->push(report); | ||||
|             } | ||||
|         } | ||||
| @ -930,7 +931,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | ||||
| 
 | ||||
|     if ((m_settings.m_gpioDir != settings.m_gpioDir) || force) | ||||
|     { | ||||
|         if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) < 0) | ||||
|         if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) != 0) | ||||
|         { | ||||
|             qCritical("LimeSDROutput::applySettings: could not set GPIO directions to %u", settings.m_gpioDir); | ||||
|         } | ||||
| @ -943,7 +944,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo | ||||
| 
 | ||||
|     if ((m_settings.m_gpioPins != settings.m_gpioPins) || force) | ||||
|     { | ||||
|         if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) < 0) | ||||
|         if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) != 0) | ||||
|         { | ||||
|             qCritical("LimeSDROutput::applySettings: could not set GPIO pins to %u", settings.m_gpioPins); | ||||
|         } | ||||
|  | ||||
| @ -244,6 +244,7 @@ bool LimeSDROutputGUI::handleMessage(const Message& message) | ||||
|     { | ||||
|         DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message; | ||||
|         ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0))); | ||||
|         ui->gpioText->setText(tr("%1").arg(report.getGPIOPins(), 2, 16, QChar('0'))); | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -880,6 +880,23 @@ QToolTip{background-color: white; color: black;}</string> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="Line" name="line_3"> | ||||
|        <property name="orientation"> | ||||
|         <enum>Qt::Vertical</enum> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QLabel" name="gpioText"> | ||||
|        <property name="toolTip"> | ||||
|         <string>GPIO bits as hex value (LSB first)</string> | ||||
|        </property> | ||||
|        <property name="text"> | ||||
|         <string>00</string> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <spacer name="horizontalSpacer_3"> | ||||
|        <property name="orientation"> | ||||
| @ -952,6 +969,39 @@ QToolTip{background-color: white; color: black;}</string> | ||||
|  </customwidgets> | ||||
|  <resources> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|  </resources> | ||||
|  <connections/> | ||||
| </ui> | ||||
|  | ||||
| @ -671,19 +671,20 @@ bool LimeSDRInput::handleMessage(const Message& message) | ||||
|     else if (MsgGetDeviceInfo::match(message)) | ||||
|     { | ||||
|         double temp = 0.0; | ||||
|         uint8_t gpioPins = 0;         | ||||
| 
 | ||||
|         if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) == 0)) | ||||
|         { | ||||
|             //qDebug("LimeSDRInput::handleMessage: MsgGetDeviceInfo: temperature: %f", temp);
 | ||||
|         if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) != 0)) { | ||||
|             qWarning("LimeSDRInput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             qDebug("LimeSDRInput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); | ||||
| 
 | ||||
|         if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GPIORead(m_deviceShared.m_deviceParams->getDevice(), &gpioPins, 1) != 0)) { | ||||
|             qWarning("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get GPIO pins values"); | ||||
|         } | ||||
| 
 | ||||
|         // send to oneself
 | ||||
|         if (m_deviceAPI->getSampleSourceGUIMessageQueue()) { | ||||
|             DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); | ||||
|         if (m_deviceAPI->getSampleSourceGUIMessageQueue())  | ||||
|         { | ||||
|             DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins); | ||||
|             m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report); | ||||
|         } | ||||
| 
 | ||||
| @ -695,7 +696,7 @@ bool LimeSDRInput::handleMessage(const Message& message) | ||||
|         { | ||||
|             if ((*itSource)->getSampleSourceGUIMessageQueue()) | ||||
|             { | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins); | ||||
|                 (*itSource)->getSampleSourceGUIMessageQueue()->push(report); | ||||
|             } | ||||
|         } | ||||
| @ -708,7 +709,7 @@ bool LimeSDRInput::handleMessage(const Message& message) | ||||
|         { | ||||
|             if ((*itSink)->getSampleSinkGUIMessageQueue()) | ||||
|             { | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); | ||||
|                 DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins); | ||||
|                 (*itSink)->getSampleSinkGUIMessageQueue()->push(report); | ||||
|             } | ||||
|         } | ||||
| @ -1107,7 +1108,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | ||||
| 
 | ||||
|     if ((m_settings.m_gpioDir != settings.m_gpioDir) || force) | ||||
|     { | ||||
|         if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) < 0) | ||||
|         if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) != 0) | ||||
|         { | ||||
|             qCritical("LimeSDROutput::applySettings: could not set GPIO directions to %u", settings.m_gpioDir); | ||||
|         } | ||||
| @ -1120,7 +1121,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc | ||||
| 
 | ||||
|     if ((m_settings.m_gpioPins != settings.m_gpioPins) || force) | ||||
|     { | ||||
|         if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) < 0) | ||||
|         if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) != 0) | ||||
|         { | ||||
|             qCritical("LimeSDROutput::applySettings: could not set GPIO pins to %u", settings.m_gpioPins); | ||||
|         } | ||||
|  | ||||
| @ -226,6 +226,7 @@ bool LimeSDRInputGUI::handleMessage(const Message& message) | ||||
|     { | ||||
|         DeviceLimeSDRShared::MsgReportDeviceInfo& report = (DeviceLimeSDRShared::MsgReportDeviceInfo&) message; | ||||
|         ui->temperatureText->setText(tr("%1C").arg(QString::number(report.getTemperature(), 'f', 0))); | ||||
|         ui->gpioText->setText(tr("%1").arg(report.getGPIOPins(), 2, 16, QChar('0'))); | ||||
|         return true; | ||||
|     } | ||||
|     else if (LimeSDRInput::MsgStartStop::match(message)) | ||||
|  | ||||
| @ -1121,6 +1121,23 @@ QToolTip{background-color: white; color: black;}</string> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="Line" name="line_5"> | ||||
|        <property name="orientation"> | ||||
|         <enum>Qt::Vertical</enum> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QLabel" name="gpioText"> | ||||
|        <property name="toolTip"> | ||||
|         <string>GPIO bits as hex value (LSB first)</string> | ||||
|        </property> | ||||
|        <property name="text"> | ||||
|         <string>00</string> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <spacer name="horizontalSpacer_3"> | ||||
|        <property name="orientation"> | ||||
| @ -1193,6 +1210,39 @@ QToolTip{background-color: white; color: black;}</string> | ||||
|  </customwidgets> | ||||
|  <resources> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|   <include location="../../../sdrgui/resources/res.qrc"/> | ||||
|  </resources> | ||||
|  <connections/> | ||||
| </ui> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user