OpenSourceEBike / ebike_wireless_remote

ANT+ remote button
10 stars 8 forks source link

merge from clean #38

Closed rananna closed 3 years ago

rananna commented 3 years ago

@casainho,

Some points: I am getting a PR conflict with your repository for main.c that I can't reolve I tried to follow the command line instructions from my end but that will not work, apparently you have to do it from your repository. Anyway, simply replace the old main.c with this one.

I checked this PR with both the makerdiary and nordic boards and it is working fine.

However, I did have to make some changes.

  1. LED control You modified the code to do basic GPIO control using nrf_gpio_pins_set and nrf_gpio_pins_clear commands. Unfortunately, nrf_gpio_pins_clear (low on the GPIO), actually turns the LED ON and nrf_gpio_pins_set turns it OFF, the opposite of what you might expect. Behavior is exactly the opposite for the Nordic dongle! That is why I chose to use the board support package (BSP) function calls to control the LEDs. It abstracts away the differences between the boards.
  2. The function leds_init was restored to use the BSP. Note that BSP_INIT does some important housekeeping that is necessary for the Nordic dongle. if you dig into this function you will see that it calls gpio_output_voltage_setup which sets the output voltage after the first regulator. If this is not called, the dongle could be set to 1.8V after mass_erase, bricking it for programming.
  3. I left WFE(); SEV(); __WFE(); in the idle loop. We can probably get away with using this with the SD, but why not use nrf_pwr_mgmt_run() which is made for use with the SD. Did you read my post on this topic from yesterday? Also, I found that my debugging issue with the makerdiary board was simply having to many breakpoints active. That was causing similar errors to what you were seeing. Try reducing your breakpoints.
  4. I note that you changed the long press to enable/disable Bluetooth to two keys. I assume this is to avoid accidentally changing it by pressing only PLUS. I changed the MD file to reflect this change.
  5. clean up of flash write was an improvement.
rananna commented 3 years ago

Also you had a board define in c_cpp_properties.json that I had to remove

casainho commented 3 years ago

There are conflicts on the main.c file. Please attach here that file so I can use it.

rananna commented 3 years ago

main.zip

github will not allow .c files, so here is a zip