forked from NanoVNA-Saver/nanovna-saver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Default for all text files | ||
* text=auto whitespace=trailing-space,tab-in-indent,tabwidth=2 | ||
*.py text=auto whitespace=trailing-space,tab-in-indent,tabwidth=4 | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import logging | ||
from NanoVNASaver.Hardware.Serial import drain_serial, Interface | ||
import serial | ||
import struct | ||
import numpy as np | ||
from PyQt5 import QtGui | ||
|
||
from NanoVNASaver.Hardware.NanoVNA import NanoVNA | ||
from NanoVNASaver.Hardware.Serial import Interface | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class NanoVNA_F_V2(NanoVNA): | ||
name = "NanoVNA-F_V2" | ||
screenwidth = 800 | ||
screenheight = 480 | ||
|
||
def __init__(self, iface: Interface): | ||
super().__init__(iface) | ||
self.sweep_max_freq_Hz = 3e9 | ||
|
||
def getScreenshot(self) -> QtGui.QPixmap: | ||
logger.debug("Capturing screenshot...") | ||
if not self.connected(): | ||
return QtGui.QPixmap() | ||
try: | ||
rgba_array = self._capture_data() | ||
image = QtGui.QImage( | ||
rgba_array, | ||
self.screenwidth, | ||
self.screenheight, | ||
QtGui.QImage.Format_RGB16) | ||
logger.debug("Captured screenshot") | ||
return QtGui.QPixmap(image) | ||
except serial.SerialException as exc: | ||
logger.exception( | ||
"Exception while capturing screenshot: %s", exc) | ||
return QtGui.QPixmap() | ||
import logging | ||
from NanoVNASaver.Hardware.Serial import drain_serial, Interface | ||
import serial | ||
import struct | ||
import numpy as np | ||
from PyQt5 import QtGui | ||
|
||
from NanoVNASaver.Hardware.NanoVNA import NanoVNA | ||
from NanoVNASaver.Hardware.Serial import Interface | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class NanoVNA_F_V2(NanoVNA): | ||
name = "NanoVNA-F_V2" | ||
screenwidth = 800 | ||
screenheight = 480 | ||
|
||
def __init__(self, iface: Interface): | ||
super().__init__(iface) | ||
self.sweep_max_freq_Hz = 3e9 | ||
|
||
def getScreenshot(self) -> QtGui.QPixmap: | ||
logger.debug("Capturing screenshot...") | ||
if not self.connected(): | ||
return QtGui.QPixmap() | ||
try: | ||
rgba_array = self._capture_data() | ||
image = QtGui.QImage( | ||
rgba_array, | ||
self.screenwidth, | ||
self.screenheight, | ||
QtGui.QImage.Format_RGB16) | ||
logger.debug("Captured screenshot") | ||
return QtGui.QPixmap(image) | ||
except serial.SerialException as exc: | ||
logger.exception( | ||
"Exception while capturing screenshot: %s", exc) | ||
return QtGui.QPixmap() |