No doubt David's situation in the I Sam 30 account was extremely difficult. He and his men returned to camp and found their dwellings and everything was burnt plus their wives and families were gone. Then the guys who just fought with David talked of killing him.
Next:
- David wept until he couldn't
- then he encouraged himself in The Lord
- he asks Yahweh what to do
Looking at this list, it seems for the most part, he dealt with his emotions first. Then he readjusted his focus back on Yahweh. David knew Yahweh was the source of his strength and courage. What were his thoughts? Perhaps he chose Psa 145 includes I extol you my Yahweh oh King. You are great and greatly to be praised and your greatness is unsearchable. I will speak of the glorious honour of thy majesty, and of thy wondrous works. Lord, you are gracious, and full of compassion; slow to anger, and of great mercy. Lord, you are good to all: and your tender mercies are over all your works. I will bless your holy name forever and ever.
Also, David didn't assume what Yahweh would want him to do. He encouraged himself in The Lord then asks Him what to do. Sometimes it's hard to hear Yahweh when things are chaotic but this process worked for David. Once David got His answer, he obeyed and was successful. So he heard accurately.