kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
bugfix: use under and over uprintable strings
rodzic
6a4800d361
commit
bd9287b9b9
|
@ -81,19 +81,18 @@ class Value:
|
|||
abs(self._value) >= 10 ** ((fmt.max_offset + 1) * 3):
|
||||
return (("-" if self._value < 0 else "") +
|
||||
"\N{INFINITY}" + fmt.space_str + self._unit)
|
||||
if (self._value < fmt.printable_min or
|
||||
self._value > fmt.printable_max):
|
||||
return fmt.unprintable_str + self._unit
|
||||
if self._value < fmt.printable_min:
|
||||
return fmt.unprintable_under + self._unit
|
||||
if self._value > fmt.printable_max:
|
||||
return fmt.unprintable_over + self._unit
|
||||
|
||||
if self._value == 0:
|
||||
offset = 0
|
||||
else:
|
||||
offset = int(math.log10(abs(self._value)) // 3)
|
||||
|
||||
if offset < fmt.min_offset:
|
||||
offset = fmt.min_offset
|
||||
elif offset > fmt.max_offset:
|
||||
offset = fmt.max_offset
|
||||
offset = clamp_value(
|
||||
int(math.log10(abs(self._value)) // 3),
|
||||
fmt.min_offset,
|
||||
fmt.max_offset)
|
||||
|
||||
real = float(self._value) / (10 ** (offset * 3))
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue