feat: add MCU communication support to write filter coefficients via serial port

This commit is contained in:
ws50529
2026-05-14 15:37:01 +08:00
parent a3a88c9830
commit 115fa001b7
12 changed files with 1952 additions and 897 deletions
+11
View File
@@ -9,11 +9,13 @@ from dea_api import (
BodeCompareParams,
BodeParams,
DesignParams,
MCUWriteParams,
add_security_headers,
calculate_bode,
calculate_bode_compare,
design_filter,
filter_csv,
write_mcu_command,
)
@@ -86,6 +88,15 @@ class DeaApiTest(unittest.TestCase):
self.assertEqual(len(body["freq"]), len(body["fixed"]["mag"]))
self.assertEqual(len(body["ideal"]["phase"]), len(body["fixed"]["phase"]))
def test_mcu_write_rejects_invalid_command_format(self):
try:
write_mcu_command(MCUWriteParams(command="hello"))
except HTTPException as exc:
self.assertEqual(exc.status_code, 400)
self.assertIn("MCU", exc.detail)
else:
raise AssertionError("Expected invalid MCU command validation to fail")
def test_filter_downsamples_plot_response_for_large_csv(self):
rows = ["value"] + [str(i) for i in range(6001)]