1
0

doc: add some infos

- add some infos in doc
- add count limit prompt in query step
This commit is contained in:
2026-06-17 12:39:12 +08:00
parent cfa02e7d85
commit 96fa6263a8
4 changed files with 90 additions and 5 deletions

View File

@@ -1,3 +1,12 @@
# LCR Connector # LCR Connector
TODO Get the resistor, capacitor, or inductor circuit which has the closest value for your given value within at most 3 devices.
# Todos
- [x] Refactor the legacy version.
- [ ] Add A-Star resolver in legacy version to replace LUT resolver.
- [ ] Use Rust to fully rewrite the legacy version as a library.
- [ ] Use Rust to create a CLI based on the library created at previous step.
- [ ] Utilize FLTK to create a GUI in desktop operating system.
- [ ] Utilize Flutter to create a GUI in mobile operating system.

View File

@@ -1,5 +1,51 @@
# LCR Connector (Legacy) # 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).

View File

@@ -1,7 +1,7 @@
[project] [project]
name = "lcr-connector" name = "lcr-connector"
version = "1.0.0" 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" readme = "README.md"
authors = [ authors = [
{ name = "yyc12345", email = "yyc12321@outlook.com" } { name = "yyc12345", email = "yyc12321@outlook.com" }

View File

@@ -149,8 +149,13 @@ class App:
App.QuerySortPriority App.QuerySortPriority
).to_response_priority() ).to_response_priority()
print("How may result are you expected?")
count_limit = self.__accept_count_value()
# build request and ask resolver # 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) response = self.__resolver.resolve(request)
# use page viewer to show result # use page viewer to show result
@@ -217,10 +222,33 @@ class App:
except ValueError: except ValueError:
print("Unknown command, please try again.") 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: def __accept_device_value(self) -> float:
while True: while True:
self.__show_prompt_arrow() self.__show_prompt_arrow()
words = input() words = input()
if words == "":
continue
value = self.__parse_human_readable_value(words) value = self.__parse_human_readable_value(words)
if value is None: if value is None:
print("Wrong value, please try again.") print("Wrong value, please try again.")
@@ -231,6 +259,8 @@ class App:
while True: while True:
self.__show_prompt_arrow() self.__show_prompt_arrow()
words = input() words = input()
if words == "":
continue
if words.endswith("%"): if words.endswith("%"):
value = self.__parse_plain_float( value = self.__parse_plain_float(