This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

The 'HOST' #define in light switch examples

In the examples I see places where there is conditional code based on the #define HOST.

For example in function nrf_mesh_init() i see that the softdevice is only enabled if HOST is undefined.

That seems to suggest that I integrate the mesh code into my firmware where I already call softdevice, then I need to ensure the HOST is defined

I have checked in the segger ide appropriate place for preprocessor defines and I see HOST is not defined there.

I wish Nordic could adopt a convention that for this example in the preprocessor definitions there is an explicit 'notHOST' which conveys to the reader that there is a significance to that hash define

The absence of 'HOST' leads to confusion, the presence of 'notHOST' will give the some relevant information.

I worked for a consultancy 2 decades ago and they drilled that into me :-)

Parents
  • Hi Mahendra,

    The "HOST" define is used when we do unit test of the modules. We could have used different name to make it clearer. Don't think the application need to do anything with that.

  • Unfortunatly I cannot do that because mesh_softdevice_setup() is called by mesh_core_setup() and that is called by main() In the light_switch_client example app. But mesh_core_setup() is never called in the light_switch_server example app.

    And just checked that mesh_softdevice_setup() is not directly called either in the server application.

    In fact in the server app, the softdevice is enabled in the function softdevice_setup() which is directly called by nrf_mesh_node_config() which is in turn called in main().

    However I see that nrf_mesh_node_config() only calls softdevice_setup() if the softdevice is currently NOT enabled. So as you say it should just work out.

Reply
  • Unfortunatly I cannot do that because mesh_softdevice_setup() is called by mesh_core_setup() and that is called by main() In the light_switch_client example app. But mesh_core_setup() is never called in the light_switch_server example app.

    And just checked that mesh_softdevice_setup() is not directly called either in the server application.

    In fact in the server app, the softdevice is enabled in the function softdevice_setup() which is directly called by nrf_mesh_node_config() which is in turn called in main().

    However I see that nrf_mesh_node_config() only calls softdevice_setup() if the softdevice is currently NOT enabled. So as you say it should just work out.

Children
No Data
Related