Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow port, protocol and port settings to be specified in profiles. #2717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed FQBN selection logic in monitor/arg command
  • Loading branch information
cmaglie committed Oct 7, 2024
commit 2194a372bbe7d115a6d6772644b706165637003a
4 changes: 4 additions & 0 deletions 4 internal/cli/arguments/fqbn.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (f *Fqbn) Set(fqbn string) {
// parameters provided by the user.
// This determine the FQBN based on:
// - the value of the FQBN flag if explicitly specified, otherwise
// - the FQBN of the selected profile if available, otherwise
// - the default FQBN value in sketch.yaml (`default_fqbn` key) if available, otherwise
// - it tries to autodetect the board connected to the given port flags
// If all above methods fails, it returns the empty string.
Expand All @@ -73,6 +74,9 @@ func (f *Fqbn) Set(fqbn string) {
// terminates the execution
func CalculateFQBNAndPort(ctx context.Context, portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, srv rpc.ArduinoCoreServiceServer, defaultFQBN, defaultAddress, defaultProtocol string, profile *rpc.SketchProfile) (string, *rpc.Port) {
fqbn := fqbnArg.String()
if fqbn == "" {
fqbn = profile.GetFqbn()
}
if fqbn == "" {
fqbn = defaultFQBN
}
Expand Down
10 changes: 4 additions & 6 deletions 10 internal/cli/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,10 @@ func runMonitorCmd(

var inst *rpc.Instance
var profile *rpc.SketchProfile
if fqbnArg.String() == "" {
if profileArg.Get() == "" {
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, sketch.GetDefaultProfile().GetName(), sketchPath)
} else {
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, profileArg.Get(), sketchPath)
}
if profileArg.Get() == "" {
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, sketch.GetDefaultProfile().GetName(), sketchPath)
} else {
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, profileArg.Get(), sketchPath)
}
if inst == nil {
inst = instance.CreateAndInit(ctx, srv)
Expand Down
24 changes: 24 additions & 0 deletions 24 internal/integrationtest/monitor/monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,5 +394,29 @@ yun.serial.disableDTR=true
require.Contains(t, string(stdout), "Configuration parity = none")
require.Contains(t, string(stdout), "Configuration stop_bits = 1")
})

t.Run("WithFQBN", func(t *testing.T) {
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-b", "arduino:avr:yun", "-m", "uno", "--raw", sketchWithPortAndConfigAndProfile)
require.NoError(t, err)
require.Contains(t, string(stdout), "Opened port: /dev/ttyPROF")
require.Contains(t, string(stdout), "Configuration rts = on") // This is taken from profile-installed AVR core (not patched by this test)
require.Contains(t, string(stdout), "Configuration dtr = on")
require.Contains(t, string(stdout), "Configuration baudrate = 19200")
require.Contains(t, string(stdout), "Configuration bits = 8")
require.Contains(t, string(stdout), "Configuration parity = none")
require.Contains(t, string(stdout), "Configuration stop_bits = 1")
})

t.Run("WithConfigFlag", func(t *testing.T) {
stdout, _, err := cli.RunWithCustomInput(quitMonitor(), "monitor", "-c", "odd", "-m", "uno", "--raw", sketchWithPortAndConfigAndProfile)
require.NoError(t, err)
require.Contains(t, string(stdout), "Opened port: /dev/ttyPROF")
require.Contains(t, string(stdout), "Configuration rts = on") // This is taken from profile-installed AVR core (not patched by this test)
require.Contains(t, string(stdout), "Configuration dtr = on")
require.Contains(t, string(stdout), "Configuration baudrate = 19200")
require.Contains(t, string(stdout), "Configuration bits = 8")
require.Contains(t, string(stdout), "Configuration parity = odd")
require.Contains(t, string(stdout), "Configuration stop_bits = 1")
})
})
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.