So far this year, 31 children died after being trapped inside parked cars on hot days, according to the group NoHeatStroke.org.

Tesla, the California-based electric car company, has added a feature to the latest version of its cars' operating software to help deal with at least some of these problems.

"My favorite new feature is the always-on max temp control for keeping kids and pets safe from overheating," Tesla (TSLA) CEO Elon Musk said in a Tweet Monday morning.

Most of the time, children who die in these circumstances are simply forgotten about by a parent or caregiver after the kids fall asleep during a car ride, according to NoHeatStroke.org. In other cases, though, a caregiver leaves a child in a car intentionally, not understanding how quickly dangerous heat can build in a closed car.

Tesla's temperature-control function will automatically keep the temperature below 105˚ Fahrenheit -- 40˚ centigrade -- inside the car by automatically opening vents or turning on the air conditioner as needed, Musk tweeted. The feature will remain on for up to 12 hours after the driver exits the vehicle, a Tesla spokesman said.

The new car control software, Version 8.0, begins rolling to Tesla Model S cars and Model X SUVs Wednesday night. Tesla updates the software to its cars "over the air" in much the same way that smartphone makers update devices. The Tesla updates can happen while the car is parked so owners don't have to take the vehicle to a dealer or service center.

A future version of the automatic temperature control feature will allow drivers to select maximum and minimum temperatures.

Related: Government releases self-driving car guidelines

General Motors (GM) has also begun adding a feature to some of its vehicles to help prevent hot car deaths. If a back door is opened before the driver gets in and starts the car, the driver will be reminded, with a warning tone and a text alert on the dashboard to check the backseat after the vehicle is tuned off. That feature is included as standard equipment in the new GMC Acadia SUV.

Other changes in the new Tesla software center around improving the Autopilot semi-autonomous driving features. In particular, these changes will make better use of radar to detect potential obstacles, Tesla has said.

A fatal crash in Florida earlier this year was caused, Tesla has said, by the failure of a camera to detect the side of a truck on a bright day. A detection system more reliant on radar could better detect some objects that are difficult for a camera to see.