I came to the thread to suggest using the CA to limit power rather than cutting it off, but Hugues already has:
i'd rather add an extra tiny wire, going to the CA, with a neat little display of the temp, with programmable treshold and alarm ? or why not, pulling down the amps automatically
i don't remember seeing much CA programming on the forum, is it possible at all ? there would be other things to add to that little box...
The code is not publicly available, AFAIK. At least one person has essentially made their own, though (heathyoung, with the "anal cyclist"). But Justin has stated that an in-progress version might have more inputs for things like thermal sensors and torque sensors, and whatnot (assuming it's not already done, or possibly partly available via the RC type CAs).
But yes, this is what I would want. Still, you can do a "thermally-scaled current-limit" even now if you like, by building an op-amp circuit that takes the thermal sensor analog output and scales it so you can then add it to the shunt voltage, and pass that on to the CA. This will result in incorrect A, Ah, and Wh readings, though, so an alternate method is proposed below it.
The positive shunt wire to the CA would be cut.
The first op-amp would read the thermal sensor, and possibly scale it (or use a second one to scale it). (variable scaling is needed because it is how you set how fast the thermal input begins to interfere with the normal operation of the system without compromising the actual current limiting you may already be using.)
Another op-amp would read the shunt voltage, simply buffering it.
Another would add the shunt voltage and the scaled thermal sensor voltage together.
The output of that would go to the CA on the positive shunt input wire.
The result of this is that as the temperature rises, the CA will read a higher current than is really there. The CA would be setup so that it can limit throttle input based on the current draw, so once the motor heats up to the point where even "normal" usage pushes it's reading over the limit, it'll throttle back to keep the current down so you don't keep pushing the motor too hard and destroy it.
Because the above method screws with the main purpose of the CA (keeping track of A/Ah/Wh), you could instead use the speedo input for this. It's just a bit more complicated to do the electronics for. Naturally, this sacrifices a different function--speed monitoring/distance.
Disconnect the CA speedo input from either the hall or the wheel sensor
Thermal sensor analog output goes to a variable scaling circuit (op-amp?) so you can alter the amount of effect the temperature has on the system, and how soon, without going into the CA settings all the time.
Scaling circuit goes into a voltage-to-frequency converter, which can probably made from the 555 timer. Basically you are emulating the "speed" of the wheel with the pulses from this.
The output of that is connected to the CA's speedo input.
Then set the CA for a maximum speed limit of whatever works for your scaling factors.
Bascially this will send pulses more often for higher temperatures, emulating a faster-spinning wheel. Once the pulses reach the specified rate, the CA will trim your throttle back to prevent further overheating. I don't know if this will work as well as doing it via the current-limiting, but it is at least an option.
You could probably OR the two signals together, so it can count wheel speed still, and can still limit actual system speed if you like, but it will not be accurate because it will be counting thermal sensor pulses, too.