doc: add some infos
- add some infos in doc - add count limit prompt in query step
This commit is contained in:
@@ -1,5 +1,51 @@
|
||||
# LCR Connector (Legacy)
|
||||
|
||||
在3个元器件内,使用给定元器件数值列表快速找到目标数值元器件的最好拼接方式,支持电阻,电容,电感
|
||||
Get the resistor, capacitor, or inductor circuit which has the closest value for your given value within at most 3 devices.
|
||||
|
||||
执行`uv run lcr-connector --help`来查阅参数手册。
|
||||
This is the legacy version of LCR Connector, although this is also refactored from true legacy version in modern Python.
|
||||
|
||||
## Usage
|
||||
|
||||
- Execute `uv sync` to configure the environment.
|
||||
- Execute `uv run lcr-connector --help` for the usage of LCR Connector.
|
||||
- After launch LCR Connector, you can see the help message in interactive console, or type `help` to see the help message.
|
||||
|
||||
Additionaly, for using LCR Connector, you need 3 list files holding all possible device standard values which are available in your laboratory.
|
||||
Each of them represents a type of device respectively, resistor, capacitor, or inductor.
|
||||
These list files are basically like this:
|
||||
|
||||
```
|
||||
100
|
||||
220
|
||||
270
|
||||
390
|
||||
470
|
||||
680
|
||||
1k
|
||||
1.2k
|
||||
1.5k
|
||||
2.2k
|
||||
3.3k
|
||||
4.7k
|
||||
6.8k
|
||||
10k
|
||||
47k
|
||||
100k
|
||||
1M
|
||||
```
|
||||
|
||||
Supported units are:
|
||||
|
||||
- n: Nano
|
||||
- p: Pico
|
||||
- u: Micro
|
||||
- m: Milli
|
||||
- k: Kilo
|
||||
- M: Mega
|
||||
- G: Giga
|
||||
|
||||
There is no physical unit for the values in the list files.
|
||||
|
||||
Unit is optional. If you don't specify a unit, the value is considered as a plain floating value.
|
||||
|
||||
Unit is **case sensitive** to distinguish between milli and mega (e.g. 1m is milli, 1M is mega).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "lcr-connector"
|
||||
version = "1.0.0"
|
||||
description = "Use as much 3 devices to reach target value for resistor, capacitor and inductor."
|
||||
description = "Get the resistor, capacitor, or inductor circuit which has the closest value for your given value within at most 3 devices."
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
{ name = "yyc12345", email = "yyc12321@outlook.com" }
|
||||
|
||||
@@ -149,8 +149,13 @@ class App:
|
||||
App.QuerySortPriority
|
||||
).to_response_priority()
|
||||
|
||||
print("How may result are you expected?")
|
||||
count_limit = self.__accept_count_value()
|
||||
|
||||
# build request and ask resolver
|
||||
request = Request(device_kind, target_value, tolerance, response_priority, 100)
|
||||
request = Request(
|
||||
device_kind, target_value, tolerance, response_priority, count_limit
|
||||
)
|
||||
response = self.__resolver.resolve(request)
|
||||
|
||||
# use page viewer to show result
|
||||
@@ -217,10 +222,33 @@ class App:
|
||||
except ValueError:
|
||||
print("Unknown command, please try again.")
|
||||
|
||||
def __accept_count_value(self) -> int:
|
||||
MAX_COUNT: int = 50
|
||||
|
||||
while True:
|
||||
self.__show_prompt_arrow()
|
||||
words = input()
|
||||
if words == "":
|
||||
continue
|
||||
|
||||
try:
|
||||
value = int(words)
|
||||
except ValueError:
|
||||
print("Wrong value, please try again.")
|
||||
continue
|
||||
|
||||
if value > MAX_COUNT or value <= 0:
|
||||
print("Wrong value, please try again.")
|
||||
else:
|
||||
return value
|
||||
|
||||
def __accept_device_value(self) -> float:
|
||||
while True:
|
||||
self.__show_prompt_arrow()
|
||||
words = input()
|
||||
if words == "":
|
||||
continue
|
||||
|
||||
value = self.__parse_human_readable_value(words)
|
||||
if value is None:
|
||||
print("Wrong value, please try again.")
|
||||
@@ -231,6 +259,8 @@ class App:
|
||||
while True:
|
||||
self.__show_prompt_arrow()
|
||||
words = input()
|
||||
if words == "":
|
||||
continue
|
||||
|
||||
if words.endswith("%"):
|
||||
value = self.__parse_plain_float(
|
||||
|
||||
Reference in New Issue
Block a user