Radak (to vv. 20 and [36][1]) and Ralbag (to v. [37][2]) seem to take a bit of a different tack than the answer given by morah hochman. They say that indeed Yonasan at first figured that he won't be able to speak with David in person because there might be people around, and therefore he'd have to use the signals. Once he saw (after he was done with those) that indeed no one else had come besides him and his servant, then he changed plans and sent his servant home, at which point David realized that the coast was clear and came out to see Yonasan.


  [1]: https://www.sefaria.org/I_Samuel.20.36?lang=bi&with=Radak&lang2=en
  [2]: https://www.sefaria.org/I_Samuel.20.37?lang=bi&with=Ralbag&lang2=en