File tree Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,28 @@ const createBoardConfig = ({
2626 sampling_rate = COMMON_SAMPLING_RATE ,
2727 serial_timeout = COMMON_TIMEOUT ,
2828 baud_Rate = COMMON_BAUD_RATE , // Default value for baud_Rate
29- } : Partial < BoardConfig > & { chords_id : string ; device_name : string ; field_pid : number ; adc_resolution : number ; channel_count : number } ) => ( {
30- chords_id,
31- device_name,
32- field_pid,
33- adc_resolution,
34- channel_count,
35- sampling_rate,
36- serial_timeout,
37- baud_Rate,
38- } ) ;
29+ } : Partial < BoardConfig > & { chords_id : string ; device_name : string ; field_pid : number ; adc_resolution : number ; channel_count : number } ) => {
30+ // Validate required parameters
31+ if ( ! chords_id || ! device_name || ! field_pid || ! adc_resolution || ! channel_count ) {
32+ throw new Error ( 'Missing required board configuration parameters' ) ;
33+ }
34+
35+ // Validate numeric parameters
36+ if ( adc_resolution <= 0 || channel_count <= 0 || sampling_rate <= 0 || serial_timeout <= 0 || baud_Rate <= 0 ) {
37+ throw new Error ( 'Invalid numeric parameters in board configuration' ) ;
38+ }
39+
40+ return {
41+ chords_id,
42+ device_name,
43+ field_pid,
44+ adc_resolution,
45+ channel_count,
46+ sampling_rate,
47+ serial_timeout,
48+ baud_Rate,
49+ } ;
50+ } ;
3951
4052export const BoardsList : ReadonlyArray < BoardConfig > = Object . freeze ( [
4153 createBoardConfig ( {
You can’t perform that action at this time.
0 commit comments